This commit is contained in:
seb
2026-10-31 20:28:39 +01:00
parent c7d1b1a5d2
commit f612c87b6e
25 changed files with 757 additions and 40 deletions

View File

@@ -0,0 +1,28 @@
/**
* Schema 4 → 3 (SQLite):
* - Drops agentprinter table
* - Removes enabled from printeragent
* - Restores clientserial, clientmodel, clientstate in printeragent
* @param {{ exec: (sql: string) => void, assertVersion: (v: number) => Promise<void>, setVersion: (v: number) => Promise<void> }} ctx
*/
export default async function downgrade({ exec, assertVersion, setVersion }) {
await assertVersion(4);
exec(`DROP TABLE IF EXISTS agentprinter;`);
try {
exec(`ALTER TABLE printeragent DROP COLUMN enabled;`);
} catch {}
try {
exec(`ALTER TABLE printeragent ADD COLUMN clientserial TEXT;`);
} catch {}
try {
exec(`ALTER TABLE printeragent ADD COLUMN clientmodel TEXT;`);
} catch {}
try {
exec(`ALTER TABLE printeragent ADD COLUMN clientstate TEXT;`);
} catch {}
await setVersion(3);
}