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

Cannot create an M2O field as NOT NULL #11605

Closed
3 tasks done
HitomiTenshi opened this issue Feb 11, 2022 · 1 comment
Closed
3 tasks done

Cannot create an M2O field as NOT NULL #11605

HitomiTenshi opened this issue Feb 11, 2022 · 1 comment

Comments

@HitomiTenshi
Copy link
Contributor

HitomiTenshi commented Feb 11, 2022

Preflight Checklist

Describe the Bug

After creating a new M2O field the "Allow NULL value" gets checked and cannot be unchecked.

Might be related to #11604 and #11510

To Reproduce

  • Create a new M2O field, make sure "Allow NULL value" is unchecked.
  • Inspect newly created M2O field, notice the checkbox is checked even though you have unchecked it before.
  • Uncheck it and save again. Results in an error.

Errors Shown

[INTERNAL_SERVER_ERROR] alter table mytable modify test int not null - ER_FK_COLUMN_CANNOT_CHANGE: Cannot change column 'test': used in a foreign key constraint 'mytable_test_foreign'

What version of Directus are you using?

9.5.1

What version of Node.js are you using?

16.14.0

What database are you using?

MariaDB 10.3.32

What browser are you using?

Chrome latest

What operating system are you using?

Windows 10

How are you deploying Directus?

Ubuntu Server 20.04, npm installation with a systemd service running it

@azrikahar
Copy link
Contributor

This should be the same underlying issue as #9089. Based on the reproduction steps, the default relational trigger created is Nullify,

chrome_EKSY8bByEL

hence why when you try to prevent NULL values now, the error pops up since there's a constraint that needs to SET NULL.

More info on this in the comment here: #9089 (comment)

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 3, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants