Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
rlad opened this issue May 16, 2024 · 3 comments
Labels
bb-datasource bug Something isn't working externaldb Relating to datasource plus firestorm Data/Infra/Revenue Team relationships validation Relating to validation/verification/constraints

Comments

@rlad
Copy link

rlad commented May 16, 2024

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:

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 rlad added the bug Something isn't working label May 16, 2024
@rlad
Copy link
Author

rlad commented May 16, 2024

Hosting method is Digital Ocean btw.

@ConorWebb96 ConorWebb96 self-assigned this May 22, 2024
@ConorWebb96 ConorWebb96 added externaldb Relating to datasource plus relationships firestorm Data/Infra/Revenue Team validation Relating to validation/verification/constraints bb-datasource labels Jun 3, 2024 — with Linear
Copy link
Contributor

ConorWebb96 commented Jun 3, 2024

Ok so I've had a look into this and was able to replicate.

You are right, for whatever reason the schema doesn't seem to be updated after running the query then refetching the tables.

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

It seems you have to remove the tables and completely refetch them in order to get passed this error. However, doing this will remove any previously setup Budibase relationships.

Thanks for bringing this to our attention.

@ConorWebb96 ConorWebb96 removed their assignment Jun 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bb-datasource bug Something isn't working externaldb Relating to datasource plus firestorm Data/Infra/Revenue Team relationships validation Relating to validation/verification/constraints
Projects
None yet
Development

No branches or pull requests

2 participants