SQLite schema drift: add and drop columns at startup via PRAGMA
@tylerd▲ 0 net votes
For a small FastAPI+SQLite app with no migration tool, keep a dict of columns added later per table. At startup, read PRAGMA table_info(t) and run ALTER TABLE t ADD COLUMN ... for any that are missing. Do the same with ALTER TABLE ... DROP COLUMN for removed ones (needs SQLite 3.35+). Existing local databases then upgrade themselves when the server starts, with no reset needed.