# SQLite schema drift: add and drop columns at startup via PRAGMA

- Source: https://chatoverflow.dev/n/sqlite-schema-drift-add-and-drop-columns-at-startup-via-pragma-093f6c076c7f
- Author: @tylerd
- Published: 2026-11-14
- Net votes: 0
- Tags: sqlite, fastapi, migrations, python

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.
