#2155·knex

TypeError: Cannot read property 'Type' of undefined in tablecompiler.js

Author: capajCreated Jul 11, 2017Updated Sep 23, 2026
LabelsNG_bug

knex 0.13.0

> [email protected] migrate /home/capaj/git_projects/looop/project-alpha/back-end
> babel-node node_modules/.bin/knex migrate:latest

  knex:pool INFO pool mysql:mysql:client0 - dispense() clients=1 available=0 +0ms
  knex:client acquired connection from pool: __knexUid1 +9ms
  knex:pool INFO pool mysql:mysql:client0 - dispense() clients=0 available=1 +1ms
  knex:query show tables like ? +1ms
  knex:bindings [ 'knex_migrations' ] +0ms
  knex:pool INFO pool mysql:mysql:client0 - dispense() clients=0 available=2 +3ms
  knex:client releasing connection to pool: __knexUid1 +2ms
  knex:pool INFO pool mysql:mysql:client0 - dispense() clients=0 available=3 +0ms
  knex:pool INFO pool mysql:mysql:client0 - dispense() clients=1 available=3 +0ms
  knex:client acquired connection from pool: __knexUid2 +0ms
  knex:query show tables like ? +1ms
  knex:bindings [ 'knex_migrations_lock' ] +0ms
  knex:client releasing connection to pool: __knexUid2 +0ms
  knex:pool INFO pool mysql:mysql:client0 - dispense() clients=0 available=3 +0ms
  knex:pool INFO pool mysql:mysql:client0 - dispense() clients=1 available=3 +1ms
  knex:client acquired connection from pool: __knexUid3 +0ms
  knex:query select * from `knex_migrations_lock` +1ms
  knex:bindings [] +1ms
  knex:client releasing connection to pool: __knexUid3 +1ms
  knex:pool INFO pool mysql:mysql:client0 - dispense() clients=0 available=3 +0ms
  knex:pool INFO pool mysql:mysql:client0 - dispense() clients=1 available=3 +0ms
  knex:client acquired connection from pool: __knexUid1 +0ms
  knex:query select `name` from `knex_migrations` order by `id` asc +1ms
  knex:bindings [] +0ms
  knex:client releasing connection to pool: __knexUid1 +0ms
  knex:pool INFO pool mysql:mysql:client0 - dispense() clients=0 available=3 +0ms
  knex:tx trx4: Starting top level transaction +66ms
  knex:pool INFO pool mysql:mysql:client0 - dispense() clients=1 available=3 +0ms
  knex:client acquired connection from pool: __knexUid2 +0ms
  knex:query BEGIN; +1ms
  knex:bindings undefined +1ms
  knex:query select * from `knex_migrations_lock` for update +1ms
  knex:bindings [] +0ms
  knex:pool INFO pool mysql:mysql:client1 - dispense() clients=0 available=1 +1ms
  knex:query update `knex_migrations_lock` set `is_locked` = ? +1ms
  knex:bindings [ 1 ] +0ms
  knex:pool INFO pool mysql:mysql:client1 - dispense() clients=0 available=2 +0ms
  knex:query show tables like ? +1ms
  knex:bindings [ 'knex_migrations' ] +0ms
  knex:query show tables like ? +0ms
  knex:bindings [ 'knex_migrations_lock' ] +1ms
  knex:query select * from `knex_migrations_lock` +0ms
  knex:bindings [] +0ms
  knex:query select `name` from `knex_migrations` order by `id` asc +1ms
  knex:bindings [] +0ms
  knex:query select max(`batch`) as `max_batch` from `knex_migrations` +2ms
  knex:bindings [] +0ms
  knex:pool INFO pool mysql:mysql:client1 - dispense() clients=1 available=2 +1ms
  knex:client acquired connection from pool: __knexUid5 +0ms
  knex:query drop table if exists `application_error_log` +1ms
  knex:bindings [] +0ms
  knex:client releasing connection to pool: __knexUid5 +0ms
  knex:pool INFO pool mysql:mysql:client1 - dispense() clients=0 available=2 +0ms
  knex:pool INFO pool mysql:mysql:client1 - dispense() clients=1 available=2 +0ms
  knex:client acquired connection from pool: __knexUid6 +0ms
  knex:query alter table `events` add `organisation_id` int, add `deleted_at` datetime, add `is_discoverable` boolean default '1' +3ms
  knex:bindings [] +0ms
  knex:query show fields from `events` where field = ? +101ms
  knex:bindings [ 'author' ] +0ms
  knex:query SELECT KCU.CONSTRAINT_NAME, KCU.TABLE_NAME, KCU.COLUMN_NAME,        KCU.REFERENCED_TABLE_NAME, KCU.REFERENCED_COLUMN_NAME,        RC.UPDATE_RULE, RC.DELETE_RULE FROM INFORMATION_SCHEMA.KEY_COLUMN_USAGE AS KCU JOIN INFORMATION_SCHEMA.REFERENTIAL_CONSTRAINTS AS RC        USING(CONSTRAINT_NAME)WHERE KCU.REFERENCED_TABLE_NAME = ?   AND KCU.CONSTRAINT_SCHEMA = ?   AND RC.CONSTRAINT_SCHEMA = ? +1ms
  knex:bindings [ 'events', 'looop', 'looop' ] +0ms
  knex:client releasing connection to pool: __knexUid6 +7ms
  knex:pool INFO pool mysql:mysql:client1 - dispense() clients=0 available=2 +0ms
Knex:warning - migrations failed with error: Cannot read property 'Type' of undefined
  knex:query update `knex_migrations_lock` set `is_locked` = ? +0ms
  knex:bindings [ 0 ] +0ms
  knex:query ROLLBACK; +1ms
  knex:bindings undefined +0ms
  knex:tx trx4: releasing connection +7ms
  knex:client releasing connection to pool: __knexUid2 +0ms
  knex:pool INFO pool mysql:mysql:client0 - dispense() clients=0 available=3 +0ms
TypeError: Cannot read property 'Type' of undefined
    at /home/capaj/git_projects/looop/project-alpha/back-end/node_modules/knex/lib/dialects/mysql/schema/tablecompiler.js:106:83
    at tryCatcher (/home/capaj/git_projects/looop/project-alpha/back-end/node_modules/bluebird/js/release/util.js:16:23)
    at Promise._settlePromiseFromHandler (/home/capaj/git_projects/looop/project-alpha/back-end/node_modules/bluebird/js/release/promise.js:512:31)
    at Promise._settlePromise (/home/capaj/git_projects/looop/project-alpha/back-end/node_modules/bluebird/js/release/promise.js:569:18)
    at Promise._settlePromiseCtx (/home/capaj/git_projects/looop/project-alpha/back-end/node_modules/bluebird/js/release/promise.js:606:10)
    at Async._drainQueue (/home/capaj/git_projects/looop/project-alpha/back-end/node_modules/bluebird/js/release/async.js:138:12)
    at Async._drainQueues (/home/capaj/git_projects/looop/project-alpha/back-end/node_modules/bluebird/js/release/async.js:143:10)
    at Immediate.Async.drainQueues (/home/capaj/git_projects/looop/project-alpha/back-end/node_modules/bluebird/js/release/async.js:17:14)
    at runCallback (timers.js:800:20)
    at tryOnImmediate (timers.js:762:5)
    at processImmediate [as _immediateCallback] (timers.js:733:5)