Use ordered SQLite migrations (Refs #75)
CI / checks (push) Successful in 5m6s

This commit is contained in:
2026-10-10 00:01:18 -04:00
parent a0663e43b8
commit 8d1bb69591
56 changed files with 1085 additions and 736 deletions
+3 -5
View File
@@ -51,14 +51,14 @@ async function instance(hostId: string, retired = false) {
describe('host deletion', () => {
it('adds the deletion marker to existing host schemas without losing hosts', async () => {
const { ensureHostSchema } = await import('../../src/lib/server/hosts/schema.js');
const { migrateHostSchema } = await import('../../src/lib/server/hosts/schema.js');
const legacy = new Database(':memory:');
try {
legacy.exec(
"CREATE TABLE ec_hosts(id TEXT PRIMARY KEY, name TEXT NOT NULL); INSERT INTO ec_hosts VALUES('old','Existing host')"
);
ensureHostSchema(legacy);
ensureHostSchema(legacy);
migrateHostSchema(legacy);
migrateHostSchema(legacy);
expect(legacy.prepare('SELECT * FROM ec_hosts').get()).toEqual({
id: 'old',
name: 'Existing host',
@@ -99,8 +99,6 @@ describe('host deletion', () => {
const file = join(fixture.root, 'game-files-sentinel');
await writeFile(file, 'Game files remain');
const { db } = await import('../../src/lib/server/db/index.js');
const { ensureGameFileSchema } = await import('../../src/lib/server/game-files/schema.js');
ensureGameFileSchema(db());
db()
.prepare(
"INSERT INTO game_file_libraries(id,name,game,description,created_at) VALUES('library','T5','t5','',?)"