Knex.js-外键约束格式不正确

Knex.js-外键约束格式不正确,knex.js,Knex.js,我正在尝试使用Knex.js查询生成器构建数据库迁移,但是我遇到了与外键关系相关的以下错误: Knex:warning - migrations failed with error: alter table `presentations` add constraint presentations_owner_id_foreign foreign key (`owner_id`) references `users` (`user_id`) - ER_CANT_CREATE_TABLE: Can'

我正在尝试使用Knex.js查询生成器构建数据库迁移,但是我遇到了与外键关系相关的以下错误:

Knex:warning - migrations failed with error: alter table `presentations` add constraint presentations_owner_id_foreign foreign key (`owner_id`) references `users` (`user_id`) - ER_CANT_CREATE_TABLE: Can't create table `application`.`#sql-35c_6a` (errno: 150 "Foreign key constraint is incorrectly formed")
这是
演示文稿
表的迁移:

exports.up = function(knex, Promise) {
  return Promise.all([
    knex.schema.createTable('presentations', function(table) {
      table.increments('presentation_id');
      table.string('title', 255);
      table.integer('owner_id');
      table.boolean('is_live');
      table.timestamps();

      table.foreign('owner_id').references('user_id').inTable('users');
    })
  ]);
};
exports.up = function(knex, Promise) {
  return Promise.all([
    knex.schema.createTable('users', function(table) {
      table.increments('user_id');
      table.string('first_name');
      table.string('last_name');
      table.string('email_address').unique();
      table.string('password');

      ...

      table.timestamps();
    })
  ]);
};
这是
用户
表的迁移:

exports.up = function(knex, Promise) {
  return Promise.all([
    knex.schema.createTable('presentations', function(table) {
      table.increments('presentation_id');
      table.string('title', 255);
      table.integer('owner_id');
      table.boolean('is_live');
      table.timestamps();

      table.foreign('owner_id').references('user_id').inTable('users');
    })
  ]);
};
exports.up = function(knex, Promise) {
  return Promise.all([
    knex.schema.createTable('users', function(table) {
      table.increments('user_id');
      table.string('first_name');
      table.string('last_name');
      table.string('email_address').unique();
      table.string('password');

      ...

      table.timestamps();
    })
  ]);
};

不同的数据类型可能有问题吗?我试图在
整数
增量
类型之间建立关系。

我对SQLite DB运行了基本代码,结果正常。不过,我没有尝试在迁移过程中运行它。该约束工作正常,防止了无效的数据输入。