Skip to content

Migrations ledger + CI check is an honor system — it doesn't verify prod schema #165

Description

@Muawiya-contact

Problem
The migrations check (added to prevent the claimed_at-style drift) only verifies that every *.sql file is listed in applied.txt (grep -qxF). It never connects to the database, so it can’t tell whether a migration was actually run on prod — a developer can add the filename to make CI green without running the SQL.

Evidencebackend/migrations/applied.txt, .github/workflows/migrations.yml:39-41.

Impact — It catches “you forgot to record it,” not “you forgot to apply it” — the exact failure it’s named for could still recur if someone lists the file but skips the SQL.

Suggested direction — Have the release/CI step actually verify prod/staging: compare applied.txt against a schema_migrations table the apply step writes to, or run a post-deploy smoke SELECT for the columns/tables each migration adds (psql "$DIRECT_URL"). That turns the honor system into verification. (Adopting Alembic would also kill the ledger and the hand-maintained models.py.)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    ciCI and automationpriority: lowPolish / nice to havereliabilityWorkers and infrastructure correctness

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions