Ghost/core/server/data/migrations/init/1-create-tables.js

15 lines
489 B
JavaScript
Raw Normal View History

var Promise = require('bluebird'),
commands = require('../../schema').commands,
logging = require('../../../logging'),
schema = require('../../schema').tables,
schemaTables = Object.keys(schema);
module.exports = function createTables(options) {
var database = options.database;
return Promise.mapSeries(schemaTables, function createTable(table) {
logging.info('Creating table: ' + table);
return commands.createTable(table, database);
});
};