Files
immich-redaktions-plugin/tests/db/download-history-index-migration-sql.test.ts
T

20 lines
829 B
TypeScript

import { readFile } from "node:fs/promises";
import path from "node:path";
import { expect, test } from "vitest";
test("0004 adds both editorial history keyset indexes without rewriting history", async () => {
const migration = await readFile(
path.join(process.cwd(), "drizzle/0004_download_history_indexes.sql"),
"utf8",
);
expect(migration).toContain(
'CREATE INDEX "download_events_editorial_authorized_id_idx" ON "download_events" USING btree ("editorial_account_id","authorized_at" DESC NULLS LAST,"id" DESC NULLS LAST)',
);
expect(migration).toContain(
'CREATE INDEX "usages_editorial_created_id_idx" ON "usages" USING btree ("editorial_account_id","created_at" DESC NULLS LAST,"id" DESC NULLS LAST)',
);
expect(migration).not.toMatch(/delete\s+from\s+"?(usages|download_events)"?/i);
});