-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathknexfile.js
More file actions
29 lines (26 loc) · 799 Bytes
/
knexfile.js
File metadata and controls
29 lines (26 loc) · 799 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
const { config } = require('dotenv');
config({ path: `.env.${process.env.NODE_ENV || 'development'}.local` });
const { NODE_ENV, DB_HOST, DB_PORT, DB_USER, DB_PASSWORD, DB_DATABASE } = process.env;
const migrateDir = NODE_ENV === 'production' ? 'dist/databases/migrations' : 'src/databases/migrations';
const seedDir = NODE_ENV === 'production' ? 'dist/databases/seeds' : 'src/databases/seeds';
module.exports = {
client: 'pg',
connection: {
charset: 'utf8',
timezone: 'UTC',
host: DB_HOST,
port: DB_PORT,
user: DB_USER,
password: DB_PASSWORD,
database: DB_DATABASE,
},
migrations: {
directory: migrateDir,
tableName: 'migrations',
// stub: 'src/databases/stubs',
},
seeds: {
directory: seedDir,
// stub: 'src/databases/stubs',
},
};