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:
parent
2af2500ccf
commit
fc9e62b1a2
1 changed files with 35 additions and 0 deletions
|
@ -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);
|
||||
});
|
||||
};
|
Loading…
Add table
Reference in a new issue