You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
But I really think OS version doesn't matter much here because I tested this on a Heroku free postgresql instance
Bug
Explain what kind of behaviour you are getting and how you think it should do
knex migrate:latest runs without an error on both version.
I'm observing this error only when using knex@^0.15.0
This is the command I used
DEBUG=* knex migrate:rollback
knex@0.14.6 (click to expand)
❯ DEBUG=* knex migrate:rollback
Using environment: development
knex:client acquired connection from pool: __knexUid1 +0ms
knex:query select * from information_schema.tables where table_name = ? and table_schema = current_schema() undefined +0ms
knex:bindings [ 'knex_migrations' ] undefined +0ms
knex:client releasing connection to pool: __knexUid1 +14ms
knex:client acquired connection from pool: __knexUid1 +2ms
knex:query select * from information_schema.tables where table_name = ? and table_schema = current_schema() undefined +14ms
knex:bindings [ 'knex_migrations_lock' ] undefined +14ms
knex:client releasing connection to pool: __knexUid1 +4ms
knex:client acquired connection from pool: __knexUid1 +1ms
knex:query select * from "knex_migrations_lock" undefined +7ms
knex:bindings [] undefined +7ms
knex:client releasing connection to pool: __knexUid1 +4ms
knex:client acquired connection from pool: __knexUid1 +1ms
knex:query select "name" from "knex_migrations" order by "id" asc undefined +2ms
knex:bindings [] undefined +2ms
knex:client releasing connection to pool: __knexUid1 +2ms
knex:client acquired connection from pool: __knexUid1 +1ms
knex:query select * from "knex_migrations" where "batch" = (select max("batch") from "knex_migrations") order by "id" desc undefined +4ms
knex:bindings [] undefined +4ms
knex:client releasing connection to pool: __knexUid1 +4ms
knex:tx trx2: Starting top level transaction +0ms
knex:client acquired connection from pool: __knexUid1 +1ms
knex:query BEGIN; trx2 +5ms
knex:bindings undefined trx2 +5ms
knex:query select * from "knex_migrations_lock" for update trx2 +3ms
knex:bindings [] trx2 +3ms
knex:query update "knex_migrations_lock" set "is_locked" = ? trx2 +2ms
knex:bindings [ 1 ] trx2 +3ms
knex:query COMMIT; trx2 +2ms
knex:bindings undefined trx2 +1ms
knex:tx trx2: releasing connection +29ms
knex:client releasing connection to pool: __knexUid1 +28ms
knex:client acquired connection from pool: __knexUid1 +6ms
knex:query select max("batch") as "max_batch" from "knex_migrations" trx2 +27ms
knex:bindings [] trx2 +27ms
knex:client releasing connection to pool: __knexUid1 +4ms
knex:tx trx3: Starting top level transaction +13ms
knex:client acquired connection from pool: __knexUid1 +4ms
knex:query BEGIN; trx3 +7ms
knex:bindings undefined trx3 +7ms
knex:query DROP VIEW IF EXISTS user_public trx3 +2ms
knex:bindings [] trx3 +3ms
knex:query COMMIT; trx3 +2ms
knex:bindings undefined trx3 +2ms
knex:tx trx3: releasing connection +9ms
knex:client releasing connection to pool: __knexUid1 +8ms
knex:client acquired connection from pool: __knexUid1 +1ms
knex:query delete from "knex_migrations" where "name" = ? trx3 +5ms
knex:bindings [ '20180804114838_add_user_public_view.js' ] trx3 +5ms
knex:client releasing connection to pool: __knexUid1 +11ms
knex:tx trx4: Starting top level transaction +12ms
knex:client acquired connection from pool: __knexUid1 +1ms
knex:query BEGIN; trx4 +13ms
knex:bindings undefined trx4 +12ms
Knex:warning - migration 20180804010903_populate_user_identity_type.js did not return a promise
knex:query COMMIT; trx4 +2ms
knex:bindings undefined trx4 +2ms
knex:tx trx4: releasing connection +5ms
knex:client releasing connection to pool: __knexUid1 +4ms
knex:client acquired connection from pool: __knexUid1 +1ms
knex:query delete from "knex_migrations" where "name" = ? trx4 +2ms
knex:bindings [ '20180804010903_populate_user_identity_type.js' ] trx4 +2ms
knex:client releasing connection to pool: __knexUid1 +5ms
knex:tx trx5: Starting top level transaction +6ms
knex:client acquired connection from pool: __knexUid1 +0ms
knex:query BEGIN; trx5 +5ms
knex:bindings undefined trx5 +6ms
knex:query
knex:query DROP TRIGGER IF EXISTS trigger_note_revision ON note
knex:query trx5 +2ms
knex:bindings [] trx5 +1ms
knex:query COMMIT; trx5 +1ms
knex:bindings undefined trx5 +1ms
knex:tx trx5: releasing connection +10ms
knex:client releasing connection to pool: __knexUid1 +11ms
knex:client acquired connection from pool: __knexUid1 +0ms
knex:query delete from "knex_migrations" where "name" = ? trx5 +8ms
knex:bindings [ '20180804010528_add_note_revision_trigger.js' ] trx5 +8ms
knex:client releasing connection to pool: __knexUid1 +11ms
knex:tx trx6: Starting top level transaction +12ms
knex:client acquired connection from pool: __knexUid1 +1ms
knex:query BEGIN; trx6 +12ms
knex:bindings undefined trx6 +12ms
knex:query DROP TABLE IF EXISTS note CASCADE trx6 +3ms
knex:bindings [] trx6 +3ms
knex:query DROP TABLE IF EXISTS note_revision CASCADE trx6 +0ms
knex:bindings [] trx6 +0ms
knex:query DROP FUNCTION IF EXISTS trigger_on_note_revision CASCADE trx6 +0ms
knex:bindings [] trx6 +1ms
knex:query COMMIT; trx6 +3ms
knex:bindings undefined trx6 +2ms
knex:tx trx6: releasing connection +11ms
knex:client releasing connection to pool: __knexUid1 +11ms
knex:client acquired connection from pool: __knexUid1 +0ms
knex:query delete from "knex_migrations" where "name" = ? trx6 +5ms
knex:bindings [ '20180803180820_add_note_table.js' ] trx6 +5ms
knex:client releasing connection to pool: __knexUid1 +10ms
knex:tx trx7: Starting top level transaction +12ms
knex:client acquired connection from pool: __knexUid1 +1ms
knex:query BEGIN; trx7 +11ms
knex:bindings undefined trx7 +11ms
knex:query
knex:query DROP TABLE IF EXISTS "user" CASCADE;
knex:query DROP TABLE IF EXISTS "user_identity" CASCADE;
knex:query DROP TABLE IF EXISTS "user_identity_type" CASCADE;
knex:query trx7 +2ms
knex:bindings [] trx7 +2ms
knex:query COMMIT; trx7 +6ms
knex:bindings undefined trx7 +6ms
knex:tx trx7: releasing connection +23ms
knex:client releasing connection to pool: __knexUid1 +23ms
knex:client acquired connection from pool: __knexUid1 +0ms
knex:query delete from "knex_migrations" where "name" = ? trx7 +16ms
knex:bindings [ '20180803175046_add_user_table.js' ] trx7 +16ms
knex:client releasing connection to pool: __knexUid1 +9ms
knex:client acquired connection from pool: __knexUid1 +1ms
knex:query update "knex_migration</s_lock" set "is_locked" = ? trx7 +9ms
knex:bindings [ 0 ] trx7 +9ms
knex:client releasing connection to pool: __knexUid1 +11ms
Batch 1 rolled back: 5 migrations
/home/khoa/web/rtop_ui/server/schema/migrations/20180804114838_add_user_public_view.js
/home/khoa/web/rtop_ui/server/schema/migrations/20180804010903_populate_user_identity_type.js
/home/khoa/web/rtop_ui/server/schema/migrations/20180804010528_add_note_revision_trigger.js
/home/khoa/web/rtop_ui/server/schema/migrations/20180803180820_add_note_table.js
/home/khoa/web/rtop_ui/server/schema/migrations/20180803175046_add_user_table.js
knex@0.15.2 (click to expand)
❯ DEBUG=* knex migrate:rollback
Using environment: development
knex:client acquired connection from pool: __knexUid1 +0ms
knex:query select * from information_schema.tables where table_name = ? and table_schema = current_schema() undefined +0ms
knex:bindings [ 'knex_migrations' ] undefined +0ms
knex:client releasing connection to pool: __knexUid1 +12ms
knex:client acquired connection from pool: __knexUid1 +0ms
knex:query select * from information_schema.tables where table_name = ? and table_schema = current_schema() undefined +11ms
knex:bindings [ 'knex_migrations_lock' ] undefined +11ms
knex:client releasing connection to pool: __knexUid1 +5ms
knex:client acquired connection from pool: __knexUid1 +1ms
knex:query select * from "knex_migrations_lock" undefined +8ms
knex:bindings [] undefined +8ms
knex:client releasing connection to pool: __knexUid1 +5ms
knex:client acquired connection from pool: __knexUid1 +0ms
knex:query select "name" from "knex_migrations" order by "id" asc undefined +3ms
knex:bindings [] undefined +3ms
knex:client releasing connection to pool: __knexUid1 +3ms
knex:client acquired connection from pool: __knexUid1 +1ms
knex:query select * from "knex_migrations" where "batch" = (select max("batch") from "knex_migrations") order by "id" desc undefined +4ms
knex:bindings [] undefined +4ms
knex:client releasing connection to pool: __knexUid1 +3ms
knex:tx trx2: Starting top level transaction +0ms
knex:client acquired connection from pool: __knexUid1 +1ms
knex:query BEGIN; trx2 +3ms
knex:bindings undefined trx2 +3ms
knex:query select * from "knex_migrations_lock" for update trx2 +3ms
knex:bindings [] trx2 +3ms
knex:query update "knex_migrations_lock" set "is_locked" = ? trx2 +5ms
knex:bindings [ 1 ] trx2 +5ms
knex:query COMMIT; trx2 +2ms
knex:bindings undefined trx2 +2ms
knex:tx trx2: releasing connection +29ms
knex:client releasing connection to pool: __knexUid1 +29ms
knex:client acquired connection from pool: __knexUid1 +5ms
knex:query select max("batch") as "max_batch" from "knex_migrations" trx2 +24ms
knex:bindings [] trx2 +25ms
knex:client releasing connection to pool: __knexUid1 +2ms
knex:tx trx3: Starting top level transaction +11ms
knex:client acquired connection from pool: __knexUid1 +4ms
knex:query BEGIN; trx3 +6ms
knex:bindings undefined trx3 +5ms
knex:query DROP VIEW IF EXISTS user_public trx3 +2ms
knex:bindings [] trx3 +2ms
knex:query COMMIT; trx3 +2ms
knex:bindings undefined trx3 +2ms
knex:tx trx3: releasing connection +23ms
knex:client releasing connection to pool: __knexUid1 +22ms
knex:client acquired connection from pool: __knexUid1 +1ms
knex:query delete from "knex_migrations" where "name" = ? trx3 +20ms
knex:bindings [ '20180804114838_add_user_public_view.js' ] trx3 +20ms
knex:client releasing connection to pool: __knexUid1 +10ms
knex:tx trx4: Starting top level transaction +11ms
knex:client acquired connection from pool: __knexUid1 +1ms
knex:query BEGIN; trx4 +10ms
knex:bindings undefined trx4 +10ms
knex:query ROLLBACK trx4 +3ms
knex:bindings undefined trx4 +3ms
knex:tx trx4: releasing connection +5ms
knex:client releasing connection to pool: __knexUid1 +4ms
migration file "20180803175046_add_user_table.js" failed
migration failed with error: Cannot read property 'knex' of undefined
knex:client acquired connection from pool: __knexUid1 +1ms
knex:query update "knex_migrations_lock" set "is_locked" = ? trx4 +3ms
knex:bindings [ 0 ] trx4 +3ms
knex:client releasing connection to pool: __knexUid1 +5ms
TypeError: Cannot read property 'knex' of undefined
at warnPromise (/home/khoa/web/rtop_ui/server/schema/node_modules/knex/lib/migrate/index.js:423:10)
at /home/khoa/web/rtop_ui/server/schema/node_modules/knex/lib/migrate/index.js:391:14
at /home/khoa/web/rtop_ui/server/schema/node_modules/knex/lib/transaction.js:75:20
at tryCatcher (/home/khoa/web/rtop_ui/server/schema/node_modules/bluebird/js/release/util.js:16:23)
at Promise._settlePromiseFromHandler (/home/khoa/web/rtop_ui/server/schema/node_modules/bluebird/js/release/promise.js:512:31)
at Promise._settlePromise (/home/khoa/web/rtop_ui/server/schema/node_modules/bluebird/js/release/promise.js:569:18)
at Promise._settlePromise0 (/home/khoa/web/rtop_ui/server/schema/node_modules/bluebird/js/release/promise.js:614:10)
at Promise._settlePromises (/home/khoa/web/rtop_ui/server/schema/node_modules/bluebird/js/release/promise.js:693:18)
at Async._drainQueue (/home/khoa/web/rtop_ui/server/schema/node_modules/bluebird/js/release/async.js:133:16)
at Async._drainQueues (/home/khoa/web/rtop_ui/server/schema/node_modules/bluebird/js/release/async.js:143:10)
at Immediate.Async.drainQueues [as _onImmediate] (/home/khoa/web/rtop_ui/server/schema/node_modules/bluebird/js/release/async.js:17:14)
at runCallback (timers.js:696:18)
at tryOnImmediate (timers.js:667:5)
at processImmediate (timers.js:649:5)
Reduced test code, for example in https://npm.runkit.com/knex or if it needs real
database connection to mysql or postgresql, then single file example which initializes
needed data and demonstrates the problem.
A reduced test code would be a migration with empty down function like this:
Environment
Knex version: 0.15.0 - 0.15.2
Database + version: Postgresql 10.4 with official Docker image
OS:
But I really think OS version doesn't matter much here because I tested this on a Heroku free postgresql instance
Bug
knex migrate:latest
runs without an error on both version.I'm observing this error only when using knex@^0.15.0
This is the command I used
knex@0.14.6 (click to expand)
knex@0.15.2 (click to expand)
database connection to mysql or postgresql, then single file example which initializes
needed data and demonstrates the problem.
A reduced test code would be a migration with empty
down
function like this:And it would fails on a random file position
The text was updated successfully, but these errors were encountered: