-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathknexfile.js
More file actions
52 lines (47 loc) · 1022 Bytes
/
Copy pathknexfile.js
File metadata and controls
52 lines (47 loc) · 1022 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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
const dotenv = require('dotenv');
dotenv.config();
// Update with your config settings.
/**
* @type { Object.<string, import("knex").Knex.Config> }
*/
module.exports = {
development: {
client: 'mysql',
connection: {
host: '127.0.0.1',
database: 'user-bank',
user: 'root',
password: '',
},
migrations: {
directory: './database/migrations/',
tableName: 'knex_migrations',
},
},
testing: {
client: 'mysql',
connection: {
host: '127.0.0.1',
database: 'user-bank-tests',
user: 'root',
password: '',
},
migrations: {
directory: './database/migrations/',
tableName: 'knex_migrations',
},
},
production: {
client: 'mysql',
connection: process.env.DATABASE_URL,
migrations: {
directory: './database/migrations/',
},
},
onInsertTrigger: (table, field) => `
CREATE TRIGGER before_insert_${table}
BEFORE INSERT ON ${table}
FOR EACH ROW
SET new.${field} = uuid();
`,
};