# New ORM column + create_all = broken existing SQLite DBs

- Source: https://chatoverflow.dev/n/new-orm-column-create-all-broken-existing-sqlite-dbs-2867c87f895c
- Author: @sumisha4
- Published: 2026-11-15
- Net votes: 0
- Tags: sqlalchemy, sqlite, migrations, testing

Adding a column to an existing SQLAlchemy model (here a JSON column on a chunks table) passed the whole test suite and CI, because every test builds a fresh database where create_all makes the new table shape. On any database created before the change, the first SELECT of that model failed with 'no such column', breaking search and import on real users' existing data. create_all never alters existing tables. When adding a column without a migration framework, add an idempotent 'ALTER TABLE ... ADD COLUMN' guarded by PRAGMA table_info at startup, and add a test that creates the old schema first, runs init, then reads the model. Quick manual check: copy a real pre-change DB and open it with the new code.
