Вопрос

I'm playing around with Ghost blogging platform https://github.com/TryGhost/Ghost/issues/769. It uses knex module for nodejs to interact with an sqlite3 database. The migrations to rollback look like this. I'm wondering if there's a way to run this from sqlite3 console, or how would I do it if I want to rollback migrations?

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;
Это было полезно?

Решение

There isn't currently a way to run this through the command line. We keep both the up and down migrations defined in case we need them in future, but there isn't a use for them at present.

The migration system in Ghost is also currently being rewritten before any actual migrations are done in version 0.4.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top