Version
main
Describe the bug.
Two migrations under crates/api-db/migrations use version 20260722120000:
20260722120000_preserve_machine_ipv6_loopback.sql
20260722120000_bmc_suppressions.sql
SQLx identifies migrations by numeric version and stores that version as the primary key in _sqlx_migrations. Applying both migrations fails because the second migration attempts to record an existing version.
This blocks test-release-container-services on main and dependent PRs. Migration versions should be unique, and both migrations should apply successfully to a fresh database.
Proposed fix:
-
Rename the newer migration to an unused version, for example:
20260722120001_bmc_suppressions.sql
-
Confirm persistent databases have the earlier migration associated with version 20260722120000:
SELECT version, description
FROM _sqlx_migrations
WHERE version = 20260722120000;
-
Add duplicate migration-version validation so future collisions fail with a focused diagnostic.
Acceptance criteria:
- Every migration in
crates/api-db/migrations has a unique version.
- Fresh-database migration succeeds.
- Existing databases containing the earlier migration upgrade successfully.
test-release-container-services passes on main.
Minimum reproducible example
find crates/api-db/migrations \
-maxdepth 1 \
-name '20260722120000_*.sql' \
-print
cargo make test-release-container-services
Relevant log output
duplicate key value violates unique constraint "_sqlx_migrations_pkey"
Key (version)=(20260722120000) already exists
Other/Misc.
No response
Code of Conduct
Version
main
Describe the bug.
Two migrations under
crates/api-db/migrationsuse version20260722120000:SQLx identifies migrations by numeric version and stores that version as the primary key in
_sqlx_migrations. Applying both migrations fails because the second migration attempts to record an existing version.This blocks
test-release-container-servicesonmainand dependent PRs. Migration versions should be unique, and both migrations should apply successfully to a fresh database.Proposed fix:
Rename the newer migration to an unused version, for example:
Confirm persistent databases have the earlier migration associated with version
20260722120000:Add duplicate migration-version validation so future collisions fail with a focused diagnostic.
Acceptance criteria:
crates/api-db/migrationshas a unique version.test-release-container-servicespasses onmain.Minimum reproducible example
find crates/api-db/migrations \ -maxdepth 1 \ -name '20260722120000_*.sql' \ -print cargo make test-release-container-servicesRelevant log output
duplicate key value violates unique constraint "_sqlx_migrations_pkey" Key (version)=(20260722120000) already existsOther/Misc.
No response
Code of Conduct