Can't apply the knex change to create multi ref table when SQL_REQUIRE_PRIMARY_KEY is enabled

  1. I created a multiref table using the ui (right click, New Multi Reference)
  2. This worked fine in my local dev environment (docker)
  3. When switching target to the live database (digital ocean managed db) and I try to apply the change, I get the following error: afbeelding

This is the knex code:


exports.up = function(knex) {
  return knex.schema
    .createTable('product_linked_courses', async function (table) {
      table.integer('product_id').unsigned();
      table.foreign('product_id').references('id').inTable('products').onUpdate('CASCADE').onDelete('CASCADE');
      table.integer('course_id').unsigned();
      table.foreign('course_id').references('id').inTable('courses').onUpdate('CASCADE').onDelete('CASCADE');
    })
};

exports.down = function(knex) {
  return knex.schema
    .dropTable('product_linked_courses')
};

If I look at knex code from an earlier made table (not multiref) it has table.increments('id') which I guess is the thing that’s missing?
afbeelding

Community Page
Last updated: