0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-02-10 23:36:14 -05:00

Added emails table migration

This commit is contained in:
Nazar Gargol 2019-11-06 12:00:09 +07:00 committed by Naz Gargol
parent 2af2500ccf
commit fc9e62b1a2

View file

@ -0,0 +1,35 @@
const common = require('../../../../lib/common');
const commands = require('../../../schema').commands;
const table = 'emails';
const message1 = 'Adding table: ' + table;
const message2 = 'Dropping table: ' + table;
module.exports.up = (options) => {
const connection = options.connection;
return connection.schema.hasTable(table)
.then(function (exists) {
if (exists) {
common.logging.warn(message1);
return;
}
common.logging.info(message1);
return commands.createTable(table, connection);
});
};
module.exports.down = (options) => {
const connection = options.connection;
return connection.schema.hasTable(table)
.then(function (exists) {
if (!exists) {
common.logging.warn(message2);
return;
}
common.logging.info(message2);
return commands.deleteTable(table, connection);
});
};