generated from kimyvgy/worker-apollo-server-template
-
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathmigrate.ts
More file actions
22 lines (15 loc) · 557 Bytes
/
migrate.ts
File metadata and controls
22 lines (15 loc) · 557 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
/* eslint-disable no-console */
import { neon } from "@neondatabase/serverless";
import { config } from "dotenv";
import { runMigration } from "~/datasources/db/runMigrations";
import { createLogger } from "~/logging";
const migrationLogger = createLogger("migration");
config({ path: process.cwd() + "/.dev.vars", override: true });
if (!process.env.NEON_URL) {
throw new Error("NEON_URL is not defined");
}
const client = neon(process.env.NEON_URL);
runMigration(client).catch((e) => {
migrationLogger.error(e as Error);
process.exit(1);
});