This may be a little late, but the error is that
table.bigInteger('AddressId').unsigned().index().inTable('Address').references('id');
should be written
table.bigInteger('AddressId').unsigned().index().references('id').inTable('Address')
The inTable function exists only after calling links, as described in the documentation http://knexjs.org/#Schema-inTable
Sets the "table" where the foreign key column is after calling column.references.
source share