Hacker News new | ask | show | jobs
by cloogshicer 486 days ago
What's difficult about schema migration? Not being snarky, genuinely curious :)
1 comments

> What's difficult about schema migration? Not being snarky, genuinely curious :)

SQLite's ALTER TABLE support isn't on par with other dbs. That's primarily (perhaps solely) because it stores table definitions as their raw SQL, rather than in some "idealized form." When SQLite first needs to understand a table's structure, it reads the original SQL which was used to create that table. Retroactively modifying arbitrary string input from the user (in this case SQL code) is a minefield.

Edit: see <https://www.sqlite.org/lang_altertable.html> in particular the final section, currently titled "Why ALTER TABLE is such a problem for SQLite"

Interesting, thanks for sharing! This sounds like a nightmare haha

What kinds of problems does this cause in practice? Do you have any examples? Not questioning you, just curious to learn more.

> Do you have any examples?

Not personally, because i've never been affected by it, but it's a topic now and again in the SQLite forum (where i'm a daily visitor).