ER_NO_SUCH_TABLE on upgrade to 2.0

Hey,

Getting an error I can’t figure out. Trying to update a blog to 2.0, but looks like something in the migration is not working?

Error:

Message: select mobiledoc_revisions.* from mobiledoc_revisions where mobiledoc_revisions.post_id in (‘597d5c5d0b1ef208e89a9740’) - ER_NO_SUCH_TABLE: Table ‘[site].mobiledoc_revisions’ doesn’t exist

Help: Error occurred while executing the following migration: 2-update-posts.js

OS: Ubuntu, v16.04
    Node Version: v6.11.1
    Ghost-CLI Version: 1.9.6
    Environment: production
    Command: 'ghost update'
    Ghost version: 1.25.5 (at /var/www/ghost)

Ghost doctor shows no issues. The post in the post_id is the very first post on the blog if that means anything. Any ideas here?

Thanks!
David B

I have the same issue :confused:

I’ve spent hours trying to understand what’s wrong.

For me this message happen when I “ghost run”. It runs the migration and in 2-update-posts.js this error happen.

$ ghost run -V
The `ghost run` command is used by the configured Ghost process manager and for debugging. If you're not running this to debug something, you should run `ghost start` instead.
+ sudo node current/index.js
[2018-10-10 17:32:35] WARN Theme's file locales/en.json not found.
[2018-10-10 17:32:35] INFO Blog is in maintenance mode.
[2018-10-10 17:32:35] INFO Ghost is running in production...
[2018-10-10 17:32:35] INFO Your blog is now available on https://blog.lemlist.com/
[2018-10-10 17:32:35] INFO Ctrl+C to shut down
[2018-10-10 17:32:35] INFO Ghost boot 1.116s
[2018-10-10 17:32:35] INFO Creating database backup
[2018-10-10 17:32:35] INFO Database backup written to: /var/www/ghost/content/data/lemlist-blog.ghost.2018-10-10.json
[2018-10-10 17:32:35] INFO Updating posts: apply new editor format and set comment_id field.
[2018-10-10 17:32:36] WARN Dropping table: mobiledoc_revisions
[2018-10-10 17:32:36] INFO Removing permissions fixtures for integrations
[2018-10-10 17:32:36] INFO Removing permissions fixtures for api_keys
[2018-10-10 17:32:36] WARN Rollback: Removing "Admin Integration" role and permissions
[2018-10-10 17:32:36] WARN Dropping integrations table
[2018-10-10 17:32:36] WARN Dropping api_keys table
[2018-10-10 17:32:36] WARN Dropping table: sessions
[2018-10-10 17:32:36] INFO Rollback: Updating posts: use old editor format
[2018-10-10 17:32:36] INFO Rollback: Updated posts: use old editor format
[2018-10-10 17:32:36] WARN Rollback: Renaming column comment_id to amp
[2018-10-10 17:32:36] WARN Rollback: Renamed column comment_id to amp
[2018-10-10 17:32:36] ERROR

NAME: MigrationScriptError
CODE: SQLITE_ERROR
MESSAGE: select `mobiledoc_revisions`.* from `mobiledoc_revisions` where `mobiledoc_revisions`.`post_id` in ('5a82a3d08b6c6c112ea82a83') - SQLITE_ERROR: no such table: mobiledoc_revisions

level:normal

{"config":{"transaction":true},"name":"2-update-posts.js~"}
"Error occurred while executing the following migration: 2-update-posts.js~"
ERROR DETAILS:
    empty

MigrationScriptError: select `mobiledoc_revisions`.* from `mobiledoc_revisions` where `mobiledoc_revisions`.`post_id` in ('5a82a3d08b6c6c112ea82a83') - SQLITE_ERROR: no such table: mobiledoc_revisions
    at MigrationScriptError.KnexMigrateError (/var/www/ghost/versions/2.2.1/node_modules/knex-migrator/lib/errors.js:7:26)
    at new MigrationScriptError (/var/www/ghost/versions/2.2.1/node_modules/knex-migrator/lib/errors.js:26:26)
    at /var/www/ghost/versions/2.2.1/node_modules/knex-migrator/lib/index.js:636:19
    at tryCatcher (/var/www/ghost/versions/2.2.1/node_modules/bluebird/js/release/util.js:16:23)
    at Promise._settlePromiseFromHandler (/var/www/ghost/versions/2.2.1/node_modules/bluebird/js/release/promise.js:512:31)
    at Promise._settlePromise (/var/www/ghost/versions/2.2.1/node_modules/bluebird/js/release/promise.js:569:18)
    at Promise._settlePromise0 (/var/www/ghost/versions/2.2.1/node_modules/bluebird/js/release/promise.js:614:10)
    at Promise._settlePromises (/var/www/ghost/versions/2.2.1/node_modules/bluebird/js/release/promise.js:689:18)
    at Async._drainQueue (/var/www/ghost/versions/2.2.1/node_modules/bluebird/js/release/async.js:133:16)
    at Async._drainQueues (/var/www/ghost/versions/2.2.1/node_modules/bluebird/js/release/async.js:143:10)
    at Immediate.Async.drainQueues (/var/www/ghost/versions/2.2.1/node_modules/bluebird/js/release/async.js:17:14)
    at runCallback (timers.js:649:20)
    at tryOnImmediate (timers.js:622:5)
    at processImmediate [as _immediateCallback] (timers.js:594:5)

Error: select `mobiledoc_revisions`.* from `mobiledoc_revisions` where `mobiledoc_revisions`.`post_id` in ('5a82a3d08b6c6c112ea82a83') - SQLITE_ERROR: no such table: mobiledoc_revisions
    at Error (native)

I just remove the file 2- and then it blocks on the migration 5-remove-demo-post.js with the error:

$ ghost run -V
The `ghost run` command is used by the configured Ghost process manager and for debugging. If you're not running this to debug something, you should run `ghost start` instead.
+ sudo node current/index.js
[2018-10-10 17:33:05] WARN Theme's file locales/en.json not found.
[2018-10-10 17:33:05] INFO Blog is in maintenance mode.
[2018-10-10 17:33:05] INFO Ghost is running in production...
[2018-10-10 17:33:05] INFO Your blog is now available on https://blog.lemlist.com/
[2018-10-10 17:33:05] INFO Ctrl+C to shut down
[2018-10-10 17:33:05] INFO Ghost boot 1.098s
[2018-10-10 17:33:05] INFO Creating database backup
[2018-10-10 17:33:06] INFO Database backup written to: /var/www/ghost/content/data/lemlist-blog.ghost.2018-10-10.json
[2018-10-10 17:33:06] INFO Renaming column amp to comment_id
[2018-10-10 17:33:06] INFO Renamed column amp to comment_id
[2018-10-10 17:33:06] INFO Updating posts: apply new editor format and set comment_id field.
[2018-10-10 17:33:06] INFO Updated posts: apply new editor format and set comment_id field.
[2018-10-10 17:33:06] INFO Removing `koenigEditor` from labs.
[2018-10-10 17:33:06] INFO Removed `koenigEditor` from labs.
[2018-10-10 17:33:06] INFO Removing `globals.permalinks` from routes.yaml.
[2018-10-10 17:33:06] INFO Removed `globals.permalinks` from routes.yaml.
[2018-10-10 17:33:06] INFO Removing demo post.
[2018-10-10 17:33:06] WARN Dropping table: mobiledoc_revisions
[2018-10-10 17:33:06] INFO Removing permissions fixtures for integrations
[2018-10-10 17:33:06] INFO Removing permissions fixtures for api_keys
[2018-10-10 17:33:06] WARN Rollback: Removing "Admin Integration" role and permissions
[2018-10-10 17:33:06] WARN Dropping integrations table
[2018-10-10 17:33:06] WARN Dropping api_keys table
[2018-10-10 17:33:06] WARN Dropping table: sessions
[2018-10-10 17:33:06] INFO Rollback: Fixture posts.
[2018-10-10 17:33:06] WARN Skip: Demo post exists.
[2018-10-10 17:33:06] INFO Rollback: Removing `globals.permalink` from routes.yaml. Nothing todo.
[2018-10-10 17:33:06] WARN Rollback: Please re-enable König Beta if required. We can't rollback this change.
[2018-10-10 17:33:06] INFO Rollback: Updating posts: use old editor format
[2018-10-10 17:33:06] INFO Rollback: Updated posts: use old editor format
[2018-10-10 17:33:06] WARN Rollback: Renaming column comment_id to amp
[2018-10-10 17:33:06] WARN Rollback: Renamed column comment_id to amp
[2018-10-10 17:33:06] ERROR

NAME: MigrationScriptError
CODE: SQLITE_ERROR
MESSAGE: Unable to update nested relation.

level:normal

{"key":"mobiledoc_revisions","tableName":"posts","method":"setHasMany"}
"Error occurred while executing the following migration: 5-remove-demo-post.js"
ERROR DETAILS:
    empty

MigrationScriptError: Unable to update nested relation.
    at MigrationScriptError.KnexMigrateError (/var/www/ghost/versions/2.2.1/node_modules/knex-migrator/lib/errors.js:7:26)
    at new MigrationScriptError (/var/www/ghost/versions/2.2.1/node_modules/knex-migrator/lib/errors.js:26:26)
    at /var/www/ghost/versions/2.2.1/node_modules/knex-migrator/lib/index.js:636:19
    at tryCatcher (/var/www/ghost/versions/2.2.1/node_modules/bluebird/js/release/util.js:16:23)
    at Promise._settlePromiseFromHandler (/var/www/ghost/versions/2.2.1/node_modules/bluebird/js/release/promise.js:512:31)
    at Promise._settlePromise (/var/www/ghost/versions/2.2.1/node_modules/bluebird/js/release/promise.js:569:18)
    at Promise._settlePromise0 (/var/www/ghost/versions/2.2.1/node_modules/bluebird/js/release/promise.js:614:10)
    at Promise._settlePromises (/var/www/ghost/versions/2.2.1/node_modules/bluebird/js/release/promise.js:689:18)
    at Async._drainQueue (/var/www/ghost/versions/2.2.1/node_modules/bluebird/js/release/async.js:133:16)
    at Async._drainQueues (/var/www/ghost/versions/2.2.1/node_modules/bluebird/js/release/async.js:143:10)
    at Immediate.Async.drainQueues (/var/www/ghost/versions/2.2.1/node_modules/bluebird/js/release/async.js:17:14)
    at runCallback (timers.js:649:20)
    at tryOnImmediate (timers.js:622:5)
    at processImmediate [as _immediateCallback] (timers.js:594:5)

BookshelfRelationsError: Unable to update nested relation.
    at new BookshelfRelationsError (/var/www/ghost/versions/2.2.1/node_modules/bookshelf-relations/errors.js:11:26)
    at setter.bind.catch (/var/www/ghost/versions/2.2.1/node_modules/bookshelf-relations/lib/relations.js:56:27)
    at tryCatcher (/var/www/ghost/versions/2.2.1/node_modules/bluebird/js/release/util.js:16:23)
    at Promise._settlePromiseFromHandler (/var/www/ghost/versions/2.2.1/node_modules/bluebird/js/release/promise.js:512:31)
    at Promise._settlePromise (/var/www/ghost/versions/2.2.1/node_modules/bluebird/js/release/promise.js:569:18)
    at Promise._settlePromise0 (/var/www/ghost/versions/2.2.1/node_modules/bluebird/js/release/promise.js:614:10)
    at Promise._settlePromises (/var/www/ghost/versions/2.2.1/node_modules/bluebird/js/release/promise.js:689:18)
    at Async._drainQueue (/var/www/ghost/versions/2.2.1/node_modules/bluebird/js/release/async.js:133:16)
    at Async._drainQueues (/var/www/ghost/versions/2.2.1/node_modules/bluebird/js/release/async.js:143:10)
    at Immediate.Async.drainQueues (/var/www/ghost/versions/2.2.1/node_modules/bluebird/js/release/async.js:17:14)
    at runCallback (timers.js:649:20)
    at tryOnImmediate (timers.js:622:5)
    at processImmediate [as _immediateCallback] (timers.js:594:5)

Error: select `mobiledoc_revisions`.* from `mobiledoc_revisions` where `mobiledoc_revisions`.`post_id` = '5bbe32ed4b0e345f7a41e928' - SQLITE_ERROR: no such table: mobiledoc_revisions
    at Error (native)

If I delete the migration 5 file, run works but it says that my password is bad, i click forgot password, receive the email, click the link, set the new password then I have a red bar with the message Request made from incorrect origin.

Really lost…

Will take a look in a bit.

Can confirm.

Ghost 2.2.1 introduced a bug. We will release a new patch early in the morning.
Will leave a notification here.

1 Like

Thanks Kate!

I have raised an issue in Ghost: Migration from v1 to v2 is broken with 2.2.1 · Issue #9983 · TryGhost/Ghost · GitHub

1 Like

2.2.2 was just released.

Let us know if you are running into any further problems, we will take care immediately :slight_smile:

1 Like

Worked for me! Thanks Kate!

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.