Add migration tracking system #81

Open
opened 2026-03-27 04:07:03 +00:00 by cal · 1 comment
Owner

Problem

Migrations are SQL files in migrations/ applied manually via psql. 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_versions table or adopt a lightweight migration tool (e.g., peewee-migrate) to track applied migrations.

Severity

Low — operational risk, especially as migration count grows.

## Problem Migrations are SQL files in `migrations/` applied manually via `psql`. 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_versions` table or adopt a lightweight migration tool (e.g., peewee-migrate) to track applied migrations. ## Severity Low — operational risk, especially as migration count grows.
Claude added the
ai-working
label 2026-03-27 10:31:18 +00:00
Claude added the
ai-pr-opened
label 2026-03-27 10:34:36 +00:00
Collaborator

PR #96 opened: #96

Approach: Added a schema_versions table (tracked via new SQL migration) and a migrations.py runner script that applies pending .sql files in sorted order and records each in the tracking table. The script uses the same PostgreSQL env vars as the API. Also removed migrations.py from .gitignore where it was incorrectly listed as a legacy root-level file.

First run on existing DBs is safe — all current migrations use IF NOT EXISTS guards.

PR #96 opened: https://git.manticorum.com/cal/major-domo-database/pulls/96 **Approach**: Added a `schema_versions` table (tracked via new SQL migration) and a `migrations.py` runner script that applies pending `.sql` files in sorted order and records each in the tracking table. The script uses the same PostgreSQL env vars as the API. Also removed `migrations.py` from `.gitignore` where it was incorrectly listed as a legacy root-level file. First run on existing DBs is safe — all current migrations use `IF NOT EXISTS` guards.
Claude removed the
ai-working
label 2026-03-27 10:34:44 +00:00
Sign in to join this conversation.
No Milestone
No project
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: cal/major-domo-database#81
No description provided.