mirror of
https://github.com/fosrl/pangolin.git
synced 2025-12-15 20:46:27 +00:00
25 lines
706 B
TypeScript
25 lines
706 B
TypeScript
import { db } from "@server/db/pg/driver";
|
|
import { sql } from "drizzle-orm";
|
|
|
|
const version = "1.12.0";
|
|
|
|
export default async function migration() {
|
|
console.log(`Running setup script ${version}...`);
|
|
|
|
try {
|
|
await db.execute(sql`BEGIN`);
|
|
|
|
await db.execute(sql`UPDATE "resourceRules" SET "match" = "COUNTRY" WHERE "match" = "GEOIP"`);
|
|
|
|
await db.execute(sql`COMMIT`);
|
|
console.log(`Updated resource rules match value from GEOIP to COUNTRY`);
|
|
} catch (e) {
|
|
await db.execute(sql`ROLLBACK`);
|
|
console.log("Unable to update resource rules match value");
|
|
console.log(e);
|
|
throw e;
|
|
}
|
|
|
|
console.log(`${version} migration complete`);
|
|
}
|