-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathknexfile.js
90 lines (84 loc) · 1.98 KB
/
knexfile.js
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
/* eslint-disable key-spacing */
const path = require('path');
// Update with your config settings.
module.exports = {
test: {
client: 'sqlite3',
connection: {
filename: ':memory:',
},
migrations: {
directory: path.join(__dirname, '/knex/mmigrations'),
},
seeds: {
directory: path.join(__dirname, '/knex/seeds/test'),
},
useNullAsDefault: true,
log: {
warn(message) {
if (!message.includes('FS-related option specified for migration configuration')
&& !message.includes('.returning() is not supported by sqlite3')) {
console.warn(message);
}
},
},
pool: {
// sqlite3 foreign key constraint is off by default, turn on manually.
afterCreate: (conn, cb) => {
conn.run('PRAGMA foreign_keys = ON', cb);
},
},
},
development: {
client: 'postgresql',
connection: {
host: 'localhost',
user: 'hashgram',
password: 'hashgram',
database: 'hashgram',
},
migrations: {
directory: path.join(__dirname, '/knex/mmigrations'),
},
seeds: {
directory: path.join(__dirname, '/knex/seeds/development'),
},
},
staging: {
client: 'postgresql',
connection: {
database: 'my_db',
user: 'username',
password: 'password',
},
pool: {
min: 2,
max: 10,
},
migrations: {
tableName: 'knex_migrations',
},
},
production: {
client: 'postgresql',
connection: {
host: process.env.DB_HOST || 'localhost',
database: process.env.DB_NAME || 'hashgram',
user: process.env.DB_USER || 'hashgram',
password: process.env.DB_PASSWORD || 'hashgram',
ssl: {
rejectUnauthorized: false,
},
},
pool: {
min: 2,
max: 10,
},
migrations: {
directory: path.join(__dirname, '/knex/mmigrations'),
},
seeds: {
directory: path.join(__dirname, '/knex/seeds/production'),
},
},
};