Ready for testing

This commit is contained in:
Julian van der Horst
2026-05-27 20:37:56 +02:00
parent e2441ce284
commit 9804c0db28
30 changed files with 308 additions and 145 deletions
+34
View File
@@ -0,0 +1,34 @@
import { APP_PATH } from "@server/lib/consts";
import Database from "better-sqlite3";
import path from "path";
const version = "1.18.5";
export default async function migration() {
console.log(`Running setup script ${version}...`);
const location = path.join(APP_PATH, "db", "db.sqlite");
const db = new Database(location);
try {
db.pragma("foreign_keys = OFF");
db.transaction(() => {
db.prepare(
`ALTER TABLE 'resources' RENAME COLUMN 'headers' TO 'requestHeaders';`
).run();
db.prepare(
`ALTER TABLE 'resources' ADD 'responseHeaders' text;`
).run();
})();
db.pragma("foreign_keys = ON");
console.log("Migrated database");
} catch (e) {
console.log("Failed to migrate db:", e);
throw e;
}
console.log(`${version} migration complete`);
}