fix: harden download history and attempt ledger
This commit is contained in:
1 parent
510fde7afa
commit
ba673ad732
19 files changed
+2287
-311
No files matched your search
@@ -0,0 +1,19 @@
|
||||
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);
|
||||
});
|
||||
Reference in new issue
Block a user