fix(db): renumber usage-identity migration to 127 (collides with 123_quota_auto_ping)

Base-red found during pre-merge validation: the fork's migration was
authored as 123_usage_history_account_identity.sql, but release/v3.8.49
already carries 123_quota_auto_ping.sql at that same numeric prefix.
getMigrationFiles() throws "Migration version collision detected" for
any duplicate version, which was failing every test that boots the DB
(db-migration-runner, usage-migrations, usage-analytics-route). Renamed
to 127 (next free slot after 126_reasoning_routing_rules.sql) and
updated the matching test-file-path references.

Co-authored-by: Xiangzhe <xiangzhedev@gmail.com>
This commit is contained in:
Diego Rodrigues de Sa e Souza
2026-07-19 12:32:37 -03:00
parent 9f10f6bb56
commit 9c3b34a832
2 changed files with 5 additions and 5 deletions

View File

@@ -1,4 +1,4 @@
-- Migration 123: Snapshot stable account identity on usage events.
-- Migration 127: Snapshot stable account identity on usage events.
-- Startup schema ensure adds the columns first so an interrupted pre-marker
-- upgrade can rerun this atomic backfill and index creation.

View File

@@ -65,7 +65,7 @@ test("migration 123 backfills account snapshots and creates its index", async ()
const runner = await importFresh("src/lib/db/migrationRunner.ts");
const db = createDb();
const migrationSql = fs.readFileSync(
"src/lib/db/migrations/123_usage_history_account_identity.sql",
"src/lib/db/migrations/127_usage_history_account_identity.sql",
"utf8"
);
@@ -97,7 +97,7 @@ test("migration 123 backfills account snapshots and creates its index", async ()
`);
const count = withMockedMigrationFs(
{ "123_usage_history_account_identity.sql": migrationSql },
{ "127_usage_history_account_identity.sql": migrationSql },
() => runner.runMigrations(db)
);
const rows = db
@@ -130,7 +130,7 @@ test("migration 123 preserves exact dedup identity and ignores non-string JSON s
const runner = await importFresh("src/lib/db/migrationRunner.ts");
const db = createDb();
const sql = fs.readFileSync(
"src/lib/db/migrations/123_usage_history_account_identity.sql",
"src/lib/db/migrations/127_usage_history_account_identity.sql",
"utf8"
);
@@ -172,7 +172,7 @@ test("migration 123 preserves exact dedup identity and ignores non-string JSON s
('', '');
`);
const count = withMockedMigrationFs({ "123_usage_history_account_identity.sql": sql }, () =>
const count = withMockedMigrationFs({ "127_usage_history_account_identity.sql": sql }, () =>
runner.runMigrations(db)
);
const rows = db