Skip to content

Commit

Permalink
Added emails table migration
Browse files Browse the repository at this point in the history
  • Loading branch information
naz committed Nov 6, 2019
1 parent 2af2500 commit fc9e62b
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions core/server/data/migrations/versions/3.1/06-add-emails-table.js
@@ -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);
});
};

0 comments on commit fc9e62b

Please sign in to comment.