@@ -18,3 +18,25 @@ surfaces disabled, and treats disappearance as `not-observed`, never closure.
1818Failures preserve the previous validated release and emit a restricted
1919failure report. Acquisition terms approval and publication approval remain
2020separate human gates.
21+
22+ ## Migration runner contract
23+
24+ ` pipeline/scripts/maintenance/apply-migrations.py ` discovers every ` *.sql ` file
25+ in the migration directory and sorts the paths lexically. The migration identity
26+ stored in ` uec.schema_migrations.version ` is the complete filename stem, not the
27+ numeric prefix. Consequently, ` 020_release_manifests.sql ` and
28+ ` 020_suppression_aware_v2_history.sql ` have distinct identities and are both
29+ applied in that lexical order. Migration files must not be renamed, edited,
30+ deleted, squashed, or resequenced after they have been applied; a new change
31+ gets a new filename.
32+
33+ The runner records the SHA-256 digest of each migration and refuses to execute
34+ an already-recorded identity when its file content has changed. Database setup
35+ and each migration run in separate transactions. A failed migration rolls back
36+ its SQL and ledger insert, while earlier successful migrations remain recorded
37+ so a subsequent run can retry and resume at the failed identity.
38+
39+ The database connection is retried up to ten times after an operational
40+ connection error, waiting one second between attempts. Connection retries do
41+ not alter migration ordering or checksum behavior. These rules are tested by
42+ ` pipeline/tests/test_apply_migrations.py ` without connecting to a database.
0 commit comments