fix: adds optimize indexes (33) to migration runner (#330)

* fix: adds optimize indexes (33) to migration runner

* chore: add changeset for migration 033 runner registration fix

* test: update migration count assertions for 033_optimize_content_indexes
This commit is contained in:
Matt ‘TK’ Taylor
2026-04-07 11:52:55 +01:00
committed by GitHub
parent a996387de4
commit 5b3e33c26b
5 changed files with 14 additions and 7 deletions

View File

@@ -0,0 +1,5 @@
---
"emdash": patch
---
Fixes migration 033 (optimize content indexes) not being registered in the static migration runner, so the composite and partial indexes it defines are now actually applied on startup.

View File

@@ -33,6 +33,7 @@ import * as m029 from "./029_redirects.js";
import * as m030 from "./030_widen_scheduled_index.js";
import * as m031 from "./031_bylines.js";
import * as m032 from "./032_rate_limits.js";
import * as m033 from "./033_optimize_content_indexes.js";
/**
* Migration provider that uses statically imported migrations.
@@ -72,6 +73,7 @@ class StaticMigrationProvider implements MigrationProvider {
"030_widen_scheduled_index": m030,
"031_bylines": m031,
"032_rate_limits": m032,
"033_optimize_content_indexes": m033,
};
}
}

View File

@@ -70,7 +70,7 @@ describe("Database Migrations", () => {
await expect(runMigrations(db)).resolves.not.toThrow();
const status = await getMigrationStatus(db);
expect(status.applied).toHaveLength(31); // 001_initial through 032_rate_limits (no 010)
expect(status.applied).toHaveLength(32); // 001_initial through 033_optimize_content_indexes (no 010)
});
it("should record migration in tracking table", async () => {
@@ -78,7 +78,7 @@ describe("Database Migrations", () => {
const records = await db.selectFrom("_emdash_migrations").selectAll().execute();
expect(records).toHaveLength(31);
expect(records).toHaveLength(32);
expect(records[0].name).toBe("001_initial");
expect(records[0].timestamp).toBeDefined();
expect(records[1].name).toBe("002_media_status");

View File

@@ -75,7 +75,7 @@ describeEachDialect("Migrations", (dialect) => {
const migrations = await ctx.db.selectFrom("_emdash_migrations").selectAll().execute();
expect(migrations).toHaveLength(31);
expect(migrations).toHaveLength(32);
expect(migrations[0]?.name).toBe("001_initial");
});
@@ -85,7 +85,7 @@ describeEachDialect("Migrations", (dialect) => {
const migrations = await ctx.db.selectFrom("_emdash_migrations").selectAll().execute();
expect(migrations).toHaveLength(31);
expect(migrations).toHaveLength(32);
});
it("reports correct migration status", async () => {

View File

@@ -57,7 +57,7 @@ describe("Database Migrations (Integration)", () => {
const migrations = await db.selectFrom("_emdash_migrations").selectAll().execute();
expect(migrations).toHaveLength(31);
expect(migrations).toHaveLength(32);
expect(migrations[0]?.name).toBe("001_initial");
expect(migrations[0]?.timestamp).toBeDefined();
expect(migrations[1]?.name).toBe("002_media_status");
@@ -98,8 +98,8 @@ describe("Database Migrations (Integration)", () => {
const migrations = await db.selectFrom("_emdash_migrations").selectAll().execute();
// Should still only have thirty-one migration records
expect(migrations).toHaveLength(31);
// Should still only have thirty-two migration records
expect(migrations).toHaveLength(32);
});
it("should report correct migration status", async () => {