-
-
Notifications
You must be signed in to change notification settings - Fork 10.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bump knex-migrator to version 3.1.1 #9199
Conversation
I'll try to find any problems till the next release on Thursday. e.g. what happens if your global installation is on 2.x. Furthermore, the CLI needs to be updated as well and released. Have to manage and test a couple of things before merging this. It's a sensitive change. |
This is on hold till we release a new CLI version including the removal of it's knex-migrator dependency and a migration command for the renewal of ssl certificates. Both will hopefully ensure that people will update to the latest CLI version and then we can merge this breaking change. |
First test succeeded. Tested with SQlite3 and MySQL. CLI 1.2.1
Has thrown an error, which is documented here. |
Second test succeeded. Install a new blog with CLI > 1.3.0 and this PR. |
The latest version of Please update the documentation to install the 3.1.1 which works ;) |
@aemonge What doesn't work? |
This is the error that I've fixed changing the version of knex-migrator: ⚙ aemonge@osboxes ~/usr/tmp/ghost knex-migrator --version
3.1.4
⚙ aemonge@osboxes ~/usr/tmp/ghost knex-migrator init --mgpath node_modules/ghost
[2018-03-06 09:14:58] INFO Creating table: posts
[2018-03-06 09:14:58] INFO Creating table: users
[2018-03-06 09:14:58] INFO Creating table: roles
[2018-03-06 09:14:58] INFO Creating table: roles_users
[2018-03-06 09:14:58] INFO Creating table: permissions
[2018-03-06 09:14:58] INFO Creating table: permissions_users
[2018-03-06 09:14:58] INFO Creating table: permissions_roles
[2018-03-06 09:14:58] INFO Creating table: permissions_apps
[2018-03-06 09:14:58] INFO Creating table: settings
[2018-03-06 09:14:58] INFO Creating table: tags
[2018-03-06 09:14:58] INFO Creating table: posts_tags
[2018-03-06 09:14:58] INFO Creating table: apps
[2018-03-06 09:14:58] INFO Creating table: app_settings
[2018-03-06 09:14:58] INFO Creating table: app_fields
[2018-03-06 09:14:58] INFO Creating table: clients
[2018-03-06 09:14:58] INFO Creating table: client_trusted_domains
[2018-03-06 09:14:58] INFO Creating table: accesstokens
[2018-03-06 09:14:58] INFO Creating table: refreshtokens
[2018-03-06 09:14:58] INFO Creating table: subscribers
[2018-03-06 09:14:58] INFO Creating table: invites
[2018-03-06 09:14:58] INFO Creating table: brute
[2018-03-06 09:14:58] INFO Creating table: webhooks
[2018-03-06 09:14:58] INFO Model: Post
[2018-03-06 09:14:58] ERROR
NAME: MigrationScriptError
MESSAGE: this.builder.queryContext is not a function
level:normal
Error occurred while executing the following migration: 2-create-fixtures.js
MigrationScriptError: this.builder.queryContext is not a function
at MigrationScriptError.KnexMigrateError (/home/aemonge/usr/tmp/ghost/node_modules/knex-migrator/lib/errors.js:9:26)
at new MigrationScriptError (/home/aemonge/usr/tmp/ghost/node_modules/knex-migrator/lib/errors.js:28:26)
at /home/aemonge/usr/tmp/ghost/node_modules/knex-migrator/lib/index.js:586:19
at tryCatcher (/home/aemonge/usr/tmp/ghost/node_modules/bluebird/js/release/util.js:16:23)
at Promise._settlePromiseFromHandler (/home/aemonge/usr/tmp/ghost/node_modules/bluebird/js/release/promise.js:512:31)
at Promise._settlePromise (/home/aemonge/usr/tmp/ghost/node_modules/bluebird/js/release/promise.js:569:18)
at Promise._settlePromise0 (/home/aemonge/usr/tmp/ghost/node_modules/bluebird/js/release/promise.js:614:10)
at Promise._settlePromises (/home/aemonge/usr/tmp/ghost/node_modules/bluebird/js/release/promise.js:689:18)
at Async._drainQueue (/home/aemonge/usr/tmp/ghost/node_modules/bluebird/js/release/async.js:133:16)
at Async._drainQueues (/home/aemonge/usr/tmp/ghost/node_modules/bluebird/js/release/async.js:143:10)
at Immediate.Async.drainQueues [as _onImmediate] (/home/aemonge/usr/tmp/ghost/node_modules/bluebird/js/release/async.js:17:14)
at runCallback (timers.js:763:18)
at tryOnImmediate (timers.js:734:5)
at processImmediate (timers.js:716:5)
TypeError: this.builder.queryContext is not a function
at Formatter.wrapAsIdentifier (/home/aemonge/usr/tmp/ghost/node_modules/knex/lib/formatter.js:147:37)
at Formatter.wrapString (/home/aemonge/usr/tmp/ghost/node_modules/knex/lib/formatter.js:246:27)
at Formatter.wrap (/home/aemonge/usr/tmp/ghost/node_modules/knex/lib/formatter.js:142:21)
at Formatter.wrapString (/home/aemonge/usr/tmp/ghost/node_modules/knex/lib/formatter.js:244:27)
at Formatter.wrap (/home/aemonge/usr/tmp/ghost/node_modules/knex/lib/formatter.js:142:21)
at Formatter.columnize (/home/aemonge/usr/tmp/ghost/node_modules/knex/lib/formatter.js:57:19)
at QueryCompiler_SQLite3.columns (/home/aemonge/usr/tmp/ghost/node_modules/knex/lib/query/compiler.js:247:35)
at /home/aemonge/usr/tmp/ghost/node_modules/knex/lib/query/compiler.js:167:31
at Array.map (<anonymous>)
at QueryCompiler_SQLite3.select (/home/aemonge/usr/tmp/ghost/node_modules/knex/lib/query/compiler.js:166:33)
at QueryCompiler_SQLite3.toSQL (/home/aemonge/usr/tmp/ghost/node_modules/knex/lib/query/compiler.js:114:27)
at Builder.toSQL (/home/aemonge/usr/tmp/ghost/node_modules/ghost/node_modules/knex/lib/query/builder.js:115:44)
at /home/aemonge/usr/tmp/ghost/node_modules/knex/lib/runner.js:52:32
at tryCatcher (/home/aemonge/usr/tmp/ghost/node_modules/bluebird/js/release/util.js:16:23)
at /home/aemonge/usr/tmp/ghost/node_modules/bluebird/js/release/using.js:185:26
at tryCatcher (/home/aemonge/usr/tmp/ghost/node_modules/bluebird/js/release/util.js:16:23) And this is the fixed output ✘ ⚙ aemonge@osboxes ~/usr/tmp/ghost knex-migrator --version
3.1.1
⚙ aemonge@osboxes ~/usr/tmp/ghost knex-migrator init --mgpath node_modules/ghost
[2018-03-06 09:19:25] INFO Creating table: posts
[2018-03-06 09:19:25] INFO Creating table: users
[2018-03-06 09:19:25] INFO Creating table: roles
[2018-03-06 09:19:25] INFO Creating table: roles_users
[2018-03-06 09:19:25] INFO Creating table: permissions
[2018-03-06 09:19:25] INFO Creating table: permissions_users
[2018-03-06 09:19:25] INFO Creating table: permissions_roles
[2018-03-06 09:19:25] INFO Creating table: permissions_apps
[2018-03-06 09:19:25] INFO Creating table: settings
[2018-03-06 09:19:25] INFO Creating table: tags
[2018-03-06 09:19:25] INFO Creating table: posts_tags
[2018-03-06 09:19:25] INFO Creating table: apps
[2018-03-06 09:19:25] INFO Creating table: app_settings
[2018-03-06 09:19:25] INFO Creating table: app_fields
[2018-03-06 09:19:25] INFO Creating table: clients
[2018-03-06 09:19:25] INFO Creating table: client_trusted_domains
[2018-03-06 09:19:25] INFO Creating table: accesstokens
[2018-03-06 09:19:25] INFO Creating table: refreshtokens
[2018-03-06 09:19:25] INFO Creating table: subscribers
[2018-03-06 09:19:25] INFO Creating table: invites
[2018-03-06 09:19:25] INFO Creating table: brute
[2018-03-06 09:19:25] INFO Creating table: webhooks
[2018-03-06 09:19:25] INFO Model: Post
[2018-03-06 09:19:26] INFO Model: Tag
[2018-03-06 09:19:26] INFO Model: Client
[2018-03-06 09:19:26] INFO Model: Role
[2018-03-06 09:19:26] INFO Model: Permission
[2018-03-06 09:19:26] INFO Model: User
[2018-03-06 09:19:27] INFO Relation: Role to Permission
[2018-03-06 09:19:27] INFO Relation: Post to Tag
[2018-03-06 09:19:27] INFO Relation: User to Role
[2018-03-06 09:19:28] INFO Finished database init!
|
Please note: we only support installing dependencies with knex-migrator 3.1.4 has bumped |
no issue
adapt major changes of km 3.0
adapt migration scripts
simplify scripts logic!
use shutdown hook
ensure rollback of fixtures works, added
down
implementationadded
detach
functionality (fixtures)final test
enable travis 😝
finish sub tasks from Breaking changes for 3.0 knex-migrator#86
test CLI 1.3 with this PR (init + migrate)
test having knex-migrator 2.x installed (globally)
test old cli version updates to this PR with v3 (error behaviour and database state)
wait for feat(db): remove knex-migrator dep, use one installed with Ghost Ghost-CLI#505 to be released
wait for to be released Acme.sh certificate renewal is not complete Ghost-CLI#495
use latest km version and add reset force true for tests
extend trouble shooting guide with any error you can find
reconsider dropping table on init - very very dangerous
test rollback with v3 from 1.5. to 1.18 -> bug permissions
Hold. I don't want to break everything, it's a sensitive update. So i'll let my brain a little time over the weekend and see if i can discover any problems e.g. breaking changes with CLI, Global Installations, Ghost...