Merge pull request #3982 from fosrl/dev

Add 1.25.3 migrations
This commit is contained in:
Owen Schwartz
2026-10-23 09:48:50 -04:00
committed by GitHub
5 changed files with 62 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.25.0";
export const APP_VERSION = "1.25.3";
export const __FILENAME = fileURLToPath(import.meta.url);
export const __DIRNAME = path.dirname(__FILENAME);
+3 -1
View File
@@ -32,6 +32,7 @@ import m23 from "./scriptsPg/1.22.0";
import m24 from "./scriptsPg/1.23.0";
import m25 from "./scriptsPg/1.24.0";
import m26 from "./scriptsPg/1.25.0";
import m27 from "./scriptsPg/1.25.3";
// THIS CANNOT IMPORT ANYTHING FROM THE SERVER
// EXCEPT FOR THE DATABASE AND THE SCHEMA
@@ -63,7 +64,8 @@ const migrations = [
{ version: "1.22.0", run: m23 },
{ version: "1.23.0", run: m24 },
{ version: "1.24.0", run: m25 },
{ version: "1.25.0", run: m26 }
{ version: "1.25.0", run: m26 },
{ version: "1.25.3", run: m27 }
// Add new migrations here as they are created
] as {
version: string;
+3 -1
View File
@@ -52,6 +52,7 @@ import m45 from "./scriptsSqlite/1.22.0";
import m46 from "./scriptsSqlite/1.23.0";
import m47 from "./scriptsSqlite/1.24.0";
import m48 from "./scriptsSqlite/1.25.0";
import m49 from "./scriptsSqlite/1.25.3";
// THIS CANNOT IMPORT ANYTHING FROM THE SERVER
// EXCEPT FOR THE DATABASE AND THE SCHEMA
@@ -100,7 +101,8 @@ const migrations = [
{ version: "1.22.0", run: m45 },
{ version: "1.23.0", run: m46 },
{ version: "1.24.0", run: m47 },
{ version: "1.25.0", run: m48 }
{ version: "1.25.0", run: m48 },
{ version: "1.25.3", run: m49 }
// Add new migrations here as they are created
] as const;
+26
View File
@@ -0,0 +1,26 @@
import { db } from "@server/db/pg/driver";
import { sql } from "drizzle-orm";
const version = "1.25.3";
export default async function migration() {
console.log(`Running setup script ${version}...`);
try {
await db.execute(sql`BEGIN`);
await db.execute(sql`
ALTER TABLE "olms" ADD "agentVersion" text;
`);
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`);
}
+29
View File
@@ -0,0 +1,29 @@
import { APP_PATH } from "@server/lib/consts";
import Database from "better-sqlite3";
import path from "path";
const version = "1.25.3";
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.transaction(() => {
db.prepare(
`
ALTER TABLE 'olms' ADD 'agentVersion' text;
`
).run();
})();
console.log("Migrated database");
} catch (e) {
console.log("Failed to migrate db:", e);
throw e;
}
console.log(`${version} migration complete`);
}