Add migration tracking system #81
Labels
No Milestone
No project
No Assignees
2 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: cal/major-domo-database#81
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
Migrations are SQL files in
migrations/applied manually viapsql. There is no tracking table or tool to record which migrations have been applied. This creates risk of double-application or missed migrations across dev/prod environments.Fix
Add a
schema_versionstable or adopt a lightweight migration tool (e.g., peewee-migrate) to track applied migrations.Severity
Low — operational risk, especially as migration count grows.
PR #96 opened: #96
Approach: Added a
schema_versionstable (tracked via new SQL migration) and amigrations.pyrunner script that applies pending.sqlfiles in sorted order and records each in the tracking table. The script uses the same PostgreSQL env vars as the API. Also removedmigrations.pyfrom.gitignorewhere it was incorrectly listed as a legacy root-level file.First run on existing DBs is safe — all current migrations use
IF NOT EXISTSguards.