You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Numbered migration files instead of one hand-typed SCHEMA_VERSION #424
sentient/store/db.py keeps the schema version as one hand-typed line, SCHEMA_VERSION = 12, with a growing comment, and the steps that update an older database are store.ensure_column calls spread over Store.open and a dozen services' start(). Two pull requests that each change the schema both edit that one line and the same block, and silently pick the same number (#401 just took 12). Columns also arrive without a bump (messages.checks, group chats, skill checks), and nothing checks that a new database and an updated old one end up with the same shape.
Proposal
One file per migration step in sentient/store/migrations/ (0013_<name>.py, or .sql where plain SQL is enough). SCHEMA_VERSION becomes the highest number, derived from the files.
Port the existing steps faithfully, in order, keeping the snapshot taken before a migration (Backup, restore and snapshots before migrations #151) and the difference between a new database and an existing one.
A test that fails when two files share a number, the numbering has a gap, or schema.sql for a new database disagrees with a database migrated from an old version (tables, columns, indexes).
"Add a migration" steps in docs/DEVELOPING.md, and an ADR, since this changes how ADR 0003 says columns are added.
Activity
refactor(store): numbered migration files instead of a hand-typed SCH…