Exclude seeded account revision from migration target occupancy

Why: U3 seeds a directory revision in every new target database, which made an empty PostgreSQL target look occupied to the migration guard.

Evidence: Isolated PostgreSQL cmd/storage-migrate integration tests passed after the previously failing cases reproduced the error.

Impact: A fresh target remains eligible for migration; existing business rows and foreign migration identities still block it.

Refs: IAM U3 Stage 7; docs/proposals/2026-10-14-iam-u3-account-contract-and-plan.md §10
This commit is contained in:
2026-10-14 14:03:53 +00:00
parent d2f9b16d1a
commit b080e98388
+5
View File
@@ -451,6 +451,11 @@ func guardIdentity(db *sql.DB, migrationID, snapID string, srcVersion int) error
func businessRows(db *sql.DB) (int64, error) {
var total int64
for _, t := range copyOrder {
// Schema setup seeds this singleton before a migration starts. It is
// replaced from the source during copying and is not target business data.
if t == "account_directory_revision" {
continue
}
var n int64
if err := db.QueryRow(`SELECT COUNT(*) FROM "` + t + `"`).Scan(&n); err != nil {
if strings.Contains(err.Error(), "does not exist") {