-
Notifications
You must be signed in to change notification settings - Fork 67
/
knexfile.js
64 lines (62 loc) · 1.59 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
// I only want migrations, rollbacks, and seeds to run when the NODE_ENV is specified
// in the knex seed/migrate command. Knex will error out if it is not specified.
if (!process.env.NODE_ENV) {
throw new Error("NODE_ENV not set");
}
require("dotenv").config();
module.exports = {
testing: {
client: "mysql",
debug: false,
connection: {
host: process.env.DB_HOST,
port: process.env.DB_PORT,
user: process.env.DB_USER,
password: process.env.DB_PASSWORD,
database: `${process.env.DB_DATABASE}_testing`,
charset: "utf8mb4",
collate: "utf8mb4_unicode_ci",
},
migrations: {
directory: "./src/db/migrations",
},
seeds: {
directory: "./src/db/seeds/dev",
},
},
development: {
client: "mysql",
debug: false,
connection: {
host: process.env.DB_HOST,
port: process.env.DB_PORT,
user: process.env.DB_USER,
password: process.env.DB_PASSWORD,
database: `${process.env.DB_DATABASE}_development`,
charset: "utf8mb4",
collate: "utf8mb4_unicode_ci",
},
migrations: {
directory: "./src/db/migrations",
},
seeds: {
directory: "./src/db/seeds/dev",
},
},
production: {
client: "mysql",
debug: false,
connection: {
host: process.env.DB_HOST,
port: process.env.DB_PORT,
user: process.env.DB_USER,
password: process.env.DB_PASSWORD,
database: `${process.env.DB_DATABASE}_production`,
charset: "utf8mb4",
collate: "utf8mb4_unicode_ci",
},
migrations: {
directory: "./src/db/migrations",
},
},
};