From: xangelo Date: Wed, 4 Dec 2024 18:16:57 +0000 (-0500) Subject: chore(db): update migrations to use DATABASE_URL X-Git-Tag: v0.4.4~24 X-Git-Url: https://git.xangelo.ca/?a=commitdiff_plain;h=ae0079572990b57818587351a0750259f77946b4;p=risinglegends.git chore(db): update migrations to use DATABASE_URL --- diff --git a/knexfile.ts b/knexfile.ts index 8a898f8..92d17cd 100644 --- a/knexfile.ts +++ b/knexfile.ts @@ -2,14 +2,13 @@ import { config as dotenv } from 'dotenv'; import type { Knex } from "knex"; dotenv(); + +const connectionUrl = process.env.DATABASE_URL; + const config: { [key: string]: Knex.Config } = { development: { client: "pg", - connection: { - database: process.env.PG_DATABASE, - user: process.env.PG_USER, - password: process.env.PG_PASSWORD - }, + connection: connectionUrl, pool: { min: 2, max: 10 @@ -21,11 +20,7 @@ const config: { [key: string]: Knex.Config } = { production: { client: "pg", - connection: { - database: process.env.PG_DATABASE, - user: process.env.PG_USER, - password: process.env.PG_PASSWORD - }, + connection: connectionUrl, pool: { min: 2, max: 10 diff --git a/package.json b/package.json index c48c954..e692d29 100644 --- a/package.json +++ b/package.json @@ -7,7 +7,7 @@ "build": "npx tsc && npx webpack", "postbuild": "cp -R public dist/", "migrate": "npx ts-node ./node_modules/knex/bin/cli.js migrate:latest", - "migrate:prod": "echo $DATABASE_URL && NODE_ENV=production npx ts-node ./node_modules/knex/bin/cli.js migrate:latest", + "migrate:prod": "NODE_ENV=production npx ts-node ./node_modules/knex/bin/cli.js migrate:latest", "seed": "npx ts-node ./node_modules/knex/bin/cli.js seed:run", "seed:prod": "NODE_ENV=production npm run seed", "dev:client": "npx webpack -w",