Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/apache/8.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Node.js 如何运行knex迁移_Node.js_Sqlite_Ghost Blog - Fatal编程技术网

Node.js 如何运行knex迁移

Node.js 如何运行knex迁移,node.js,sqlite,ghost-blog,Node.js,Sqlite,Ghost Blog,我在玩鬼博客平台。它使用knex模块与sqlite3数据库进行交互。要回滚的迁移如下所示。我想知道是否有办法从sqlite3控制台运行这个程序,或者如果我想回滚迁移,我该如何做 down = function () { return when.all([ knex.schema.dropTableIfExists('posts_tags'), knex.schema.dropTableIfExists('roles_users'), kne

我在玩鬼博客平台。它使用knex模块与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;

目前没有通过命令行运行此操作的方法。我们保留了上下迁移的定义,以备将来需要,但目前它们没有用处

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