0

我正在玩 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;
4

1 回答 1

1

目前没有办法通过命令行运行它。我们保留了向上和向下迁移的定义,以防我们将来需要它们,但目前它们没有用处。

在 0.4 版中完成任何实际迁移之前,目前也正在重写 Ghost 中的迁移系统。

于 2013-11-10T18:27:26.660 回答