bump version and add 1.23 migrations

This commit is contained in:
miloschwartz
2026-09-14 17:18:31 -04:00
parent d23028d38e
commit 8f1344a665
5 changed files with 78 additions and 3 deletions
+1 -1
View File
@@ -2,7 +2,7 @@ import path from "path";
import { fileURLToPath } from "url";
// This is a placeholder value replaced by the build process
export const APP_VERSION = "1.22.0";
export const APP_VERSION = "1.23.0";
export const __FILENAME = fileURLToPath(import.meta.url);
export const __DIRNAME = path.dirname(__FILENAME);
+3 -1
View File
@@ -29,6 +29,7 @@ import m20 from "./scriptsPg/1.19.0";
import m21 from "./scriptsPg/1.20.0";
import m22 from "./scriptsPg/1.21.0";
import m23 from "./scriptsPg/1.22.0";
import m24 from "./scriptsPg/1.23.0";
// THIS CANNOT IMPORT ANYTHING FROM THE SERVER
// EXCEPT FOR THE DATABASE AND THE SCHEMA
@@ -57,7 +58,8 @@ const migrations = [
{ version: "1.19.0", run: m20 },
{ version: "1.20.0", run: m21 },
{ version: "1.21.0", run: m22 },
{ version: "1.22.0", run: m23 }
{ version: "1.22.0", run: m23 },
{ version: "1.23.0", run: m24 }
// Add new migrations here as they are created
] as {
version: string;
+3 -1
View File
@@ -48,6 +48,7 @@ import m42 from "./scriptsSqlite/1.19.1";
import m43 from "./scriptsSqlite/1.20.0";
import m44 from "./scriptsSqlite/1.21.0";
import m45 from "./scriptsSqlite/1.22.0";
import m46 from "./scriptsSqlite/1.23.0";
// THIS CANNOT IMPORT ANYTHING FROM THE SERVER
// EXCEPT FOR THE DATABASE AND THE SCHEMA
@@ -93,7 +94,8 @@ const migrations = [
{ version: "1.19.1", run: m42 },
{ version: "1.20.0", run: m43 },
{ version: "1.21.0", run: m44 },
{ version: "1.22.0", run: m45 }
{ version: "1.22.0", run: m45 },
{ version: "1.23.0", run: m46 }
// Add new migrations here as they are created
] as const;
+32
View File
@@ -0,0 +1,32 @@
import { db } from "@server/db/pg/driver";
import { sql } from "drizzle-orm";
const version = "1.23.0";
await migration();
export default async function migration() {
console.log(`Running setup script ${version}...`);
try {
await db.execute(sql`BEGIN`);
await db.execute(sql`
ALTER TABLE "newt" ADD COLUMN "agent" varchar;
`);
await db.execute(sql`
ALTER TABLE "newt" ADD COLUMN "agentVersion" varchar;
`);
await db.execute(sql`COMMIT`);
console.log("Migrated database");
} catch (e) {
await db.execute(sql`ROLLBACK`);
console.log("Unable to migrate database");
console.log(e);
throw e;
}
console.log(`${version} migration complete`);
}
+39
View File
@@ -0,0 +1,39 @@
import { APP_PATH } from "@server/lib/consts";
import Database from "better-sqlite3";
import path from "path";
const version = "1.23.0";
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 'newt' ADD 'agent' text;
`
).run();
db.prepare(
`
ALTER TABLE 'newt' ADD 'agentVersion' 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`);
}