Require application-owned backups for migrations
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
# Contract: Database Patterns (Go / MySQL / MariaDB)
|
||||
|
||||
Version: 1.4
|
||||
Version: 1.5
|
||||
|
||||
## MySQL Transaction Cursor Safety (CRITICAL)
|
||||
|
||||
@@ -122,11 +122,12 @@ Rules:
|
||||
- "Small" or "safe" changes are not exceptions.
|
||||
- The operator must know how to restore from that backup before applying the change.
|
||||
- If a migration or script is intended for production/staging, the rollout instructions must state the backup step explicitly.
|
||||
- The backup taken before a migration must be triggered by the application's own backup mechanism, not by assuming `mysql`, `mysqldump`, or other DB client tools exist on the user's machine.
|
||||
|
||||
## Migration Policy
|
||||
|
||||
- Migrations are numbered sequentially and never modified after merge.
|
||||
- Take and verify a fresh backup before applying migrations to any non-ephemeral database.
|
||||
- Trigger, take, and verify a fresh backup through the application-owned backup mechanism before applying migrations to any non-ephemeral database.
|
||||
- Each migration must be reversible where possible (document rollback in a comment).
|
||||
- Never rename a column in one migration step — add new, backfill, drop old across separate deploys.
|
||||
- Auto-apply migrations on startup is acceptable for internal tools; document if used.
|
||||
|
||||
Reference in New Issue
Block a user