budibase icon indicating copy to clipboard operation
budibase copied to clipboard

Many-to-many MySQL relationship giving erroneous "Ensure non-key columns are nullable or auto-generated" error

Open rlad opened this issue 3 months ago • 3 comments

Checklist

  • [x ] I have searched budibase discussions and github issues to check if my issue already exists

Hosting

  • Self
    • Method:
    • Budibase Version: <2.26.4>
    • App Version:
  • Cloud
    • Tenant ID: <tenantId>

Describe the bug Following the tutorial at: https://docs.budibase.com/docs/mysql-mariadb

I get the error:

"Ensure non-key columns are nullable or auto-generated"

when attempting to define the many-to-many relationship using dept_emp, even after having changed the from_date and to_date fields to nullable using:

ALTER TABLE employees.dept_emp CHANGE COLUMN from_date from_date DATE NULL , CHANGE COLUMN to_date to_date DATE NULL ;

I verified that the table was correctly changed using DESCRIBE.

Screen Shot 2024-05-16 at 1 41 07 AM

Additionally, the tutorial says to define the: One Employee -> Many Titles (Historical) relationship first, then update the dept_emp table to have nullable fields, then has the note: "Make sure to re-fetch the tables to pull down the new schema information!"

Following this advice deletes the "One Employee -> Many Titles (Historical)" relationship that was just defined. Deleting all relationships whenever the schema needs to be updated is extremely inconvenient and appears not to be the intended behavior.

To Reproduce Follow the steps as described above.

Expected behavior Expected is that steps described in the tutorial should work!

rlad avatar May 16 '24 08:05 rlad