Skip to content

Commit 70342fc

Browse files
chore: run migrations in prod (#16)
1 parent 7b694b0 commit 70342fc

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
"dev": "next dev --turbopack",
77
"start": "next start",
88
"db:migrate": "node ./scripts/migrate.mjs",
9+
"db:migrate:prod": "NODE_ENV=production node ./scripts/migrate.mjs",
910
"lint": "next lint --quiet",
1011
"build": "cross-env TSC_COMPILE_ON_ERROR=true next build",
1112
"prepare": "husky",

scripts/migrate.mjs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
import { fileURLToPath } from 'url';
22
import postgres from 'postgres';
33
import shift from 'postgres-shift';
4-
import '@dotenvx/dotenvx/config';
4+
import { config } from '@dotenvx/dotenvx';
5+
6+
const envFile =
7+
process.env.NODE_ENV === 'production' ? '.env.production' : '.env';
8+
config({ path: envFile });
59

610
const { PGHOST, PGPORT, PGDATABASE, PGUSERNAME, PGPASSWORD, PGSSLMODE } =
711
process.env;

0 commit comments

Comments
 (0)