mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-22 02:11:44 +03:00
6f6c8f4521
refs #9178 - avoid importing 4 modules (logging, errors, events and i18n) - simply require common in each file
31 lines
1.0 KiB
JavaScript
31 lines
1.0 KiB
JavaScript
var Promise = require('bluebird'),
|
|
commands = require('../../schema').commands,
|
|
schema = require('../../schema').tables,
|
|
common = require('../../../lib/common'),
|
|
schemaTables = Object.keys(schema);
|
|
|
|
module.exports.up = function createTables(options) {
|
|
var connection = options.connection;
|
|
|
|
return Promise.mapSeries(schemaTables, function createTable(table) {
|
|
common.logging.info('Creating table: ' + table);
|
|
return commands.createTable(table, connection);
|
|
});
|
|
};
|
|
|
|
/**
|
|
*
|
|
@TODO: This works, but is very dangerous in the current state of the knex-migrator v3.
|
|
@TODO: Enable if knex-migrator v3 is stable.
|
|
module.exports.down = function dropTables(options) {
|
|
var connection = options.connection;
|
|
|
|
// Reference between tables!
|
|
schemaTables.reverse();
|
|
return Promise.mapSeries(schemaTables, function dropTable(table) {
|
|
common.logging.info('Drop table: ' + table);
|
|
return commands.deleteTable(table, connection);
|
|
});
|
|
};
|
|
*/
|