shorten share links and add migration

This commit is contained in:
miloschwartz 2025-04-04 22:58:01 -04:00
parent c64eee82e7
commit 99680034a2
12 changed files with 231 additions and 63 deletions

View file

@ -18,6 +18,7 @@ import m13 from "./scripts/1.0.0-beta13";
import m15 from "./scripts/1.0.0-beta15";
import m16 from "./scripts/1.0.0";
import m17 from "./scripts/1.1.0";
import m18 from "./scripts/1.2.0";
// THIS CANNOT IMPORT ANYTHING FROM THE SERVER
// EXCEPT FOR THE DATABASE AND THE SCHEMA
@ -35,7 +36,8 @@ const migrations = [
{ version: "1.0.0-beta.13", run: m13 },
{ version: "1.0.0-beta.15", run: m15 },
{ version: "1.0.0", run: m16 },
{ version: "1.1.0", run: m17 }
{ version: "1.1.0", run: m17 },
{ version: "1.2.0", run: m18 }
// Add new migrations here as they are created
] as const;

View file

@ -0,0 +1,23 @@
import db from "@server/db";
import { sql } from "drizzle-orm";
const version = "1.2.0";
export default async function migration() {
console.log(`Running setup script ${version}...`);
try {
db.transaction((trx) => {
trx.run(
sql`ALTER TABLE 'resources' ADD 'enabled' integer DEFAULT true NOT NULL;`
);
});
console.log(`Migrated database schema`);
} catch (e) {
console.log("Unable to migrate database schema");
throw e;
}
console.log(`${version} migration complete`);
}