-
-
Notifications
You must be signed in to change notification settings - Fork 10.4k
/
1-add-webhooks-table.js
37 lines (30 loc) · 1.03 KB
/
1-add-webhooks-table.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
'use strict';
const logging = require('../../../../logging'),
commands = require('../../../schema').commands,
table = 'webhooks',
message1 = 'Adding table: ' + table,
message2 = 'Dropping table: ' + table;
module.exports.up = function addWebhooksTable(options) {
let connection = options.connection;
return connection.schema.hasTable(table)
.then(function (exists) {
if (exists) {
logging.warn(message1);
return Promise.resolve();
}
logging.info(message1);
return commands.createTable(table, connection);
});
};
module.exports.down = function removeWebhooksTable(options) {
let connection = options.connection;
return connection.schema.hasTable(table)
.then(function (exists) {
if (!exists) {
logging.warn(message2);
return Promise.resolve();
}
logging.info(message2);
return commands.deleteTable(table, connection);
});
};