我正在玩 Ghost 博客平台https://github.com/TryGhost/Ghost/issues/769。它使用 knex 模块让 nodejs 与 sqlite3 数据库交互。回滚的迁移看起来像这样。我想知道是否有办法从 sqlite3 控制台运行它,或者如果我想回滚迁移,我该怎么做?
down = function () {
return when.all([
knex.schema.dropTableIfExists('posts_tags'),
knex.schema.dropTableIfExists('roles_users'),
knex.schema.dropTableIfExists('permissions_users'),
knex.schema.dropTableIfExists('permissions_roles'),
knex.schema.dropTableIfExists('users')
]).then(function () {
return when.all([
knex.schema.dropTableIfExists('roles'),
knex.schema.dropTableIfExists('settings'),
knex.schema.dropTableIfExists('permissions'),
knex.schema.dropTableIfExists('tags'),
knex.schema.dropTableIfExists('posts')
]);
});
};
exports.up = up;
exports.down = down;
exports.constraints = constraints;