-
Notifications
You must be signed in to change notification settings - Fork 1
/
knexfile.ts
44 lines (41 loc) · 941 Bytes
/
knexfile.ts
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
import path from 'path';
import { Config } from 'knex';
import { env } from './src/settings/env';
// map from sequelize wording to knex wording
const databaseMap = {
postgres: 'postgresql'
};
const config: Config = {
client: databaseMap[env.DB_DIALECT],
connection: {
database: env.DB_DATABASE,
user: env.DB_USERNAME,
password: env.DB_PASSWORD,
port: parseInt(env.DB_PORT, 10)
},
searchPath: env.DB_SCHEMA,
pool: {
min: 2,
max: 10
},
seeds: {
directory: path.resolve(__dirname, './src/seeders')
},
migrations: {
directory: path.resolve(__dirname, './src/migrations'),
tableName: 'knex_migrations'
}
};
module.exports = {
development: config,
testing: {
...config,
connection: {
// database would be dynamic later. Need to figure out how to do it in knex
database: 'todo',
user: 'postgres',
password: 'docker'
}
},
production: config
};