Migration inventory and change gate
Current state
Migration history is not currently a fresh-environment bootstrap contract. SQL files exist in three directories:
migrations/— 49 tracked SQL files, numbered001through050with a historical010gap.server/migrations/— 7 tracked SQL files.drizzle/— 1 tracked SQL file (010_client_document_upload.sql).
The following sequence numbers collide across directories: 027, 028, 035, 036, 045, 046, and 047. For example, 045_email_digest_log.sql and 045_archive_stale_tasks.sql are different migrations. npm run db:push is intentionally disabled.
Do not do this
- Do not run every file alphabetically.
- Do not delete, rename, move, or renumber a migration.
- Do not use Drizzle push as a shortcut.
- Do not apply a migration to staging or production from this runbook.
Those actions require database/schema authority and an applied-state inventory.
Required remediation packet before any consolidation
- Read the applied migration/schema state for each approved environment.
- Produce an old-path/filename/checksum → canonical-sequence mapping.
- Identify each collision and prove whether its SQL has already been applied.
- Define a no-data-loss rollback/restore point and test it on an approved non-production branch.
- Obtain approval for every schema mutation, then apply one reviewed migration runner.
- Preserve the old paths as documented compatibility pointers until independent verification proves the canonical inventory matches each environment.
This page is a current evidence register, not authorization to mutate a database.
