mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-22 18:31:57 +03:00
caea330647
no issue Logging is now controlled by a logginrc.js file in the root of the project - and now we can just import @tryghost/logging everywhere
31 lines
1.0 KiB
JavaScript
31 lines
1.0 KiB
JavaScript
const Promise = require('bluebird');
|
|
const commands = require('../../schema').commands;
|
|
const schema = require('../../schema').tables;
|
|
const logging = require('@tryghost/logging');
|
|
const schemaTables = Object.keys(schema);
|
|
|
|
module.exports.up = function createTables(options) {
|
|
const connection = options.connection;
|
|
|
|
return Promise.mapSeries(schemaTables, function createTable(table) {
|
|
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) {
|
|
logging.info('Drop table: ' + table);
|
|
return commands.deleteTable(table, connection);
|
|
});
|
|
};
|
|
*/
|