mirror of
https://github.com/fosrl/pangolin.git
synced 2026-05-01 21:21:06 +00:00
Add basic migration files
This commit is contained in:
parent
757bb39622
commit
6f71af278e
4 changed files with 56 additions and 2 deletions
22
server/setup/scriptsPg/1.17.0.ts
Normal file
22
server/setup/scriptsPg/1.17.0.ts
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
import { db } from "@server/db/pg/driver";
|
||||
import { sql } from "drizzle-orm";
|
||||
|
||||
const version = "1.17.0";
|
||||
|
||||
export default async function migration() {
|
||||
console.log(`Running setup script ${version}...`);
|
||||
|
||||
try {
|
||||
await db.execute(sql`BEGIN`);
|
||||
|
||||
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`);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue