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

Errors when adding multiple M2O fields to the same related collection #22990

Open
rijkvanzanten opened this issue Jul 11, 2024 · 0 comments
Open

Comments

@rijkvanzanten
Copy link
Member

Describe the Bug

When adding multiple many to one fields that point to the same related collection, the API will throw a 500 error and log:

Error: Introducing FOREIGN KEY constraint '<constraint_name>' on table 'singleton' may cause cycles or multiple cascade paths. Specify ON DELETE NO ACTION or ON UPDATE NO ACTION, or modify other FOREIGN KEY constraints.

This is because Directus defaults to ON DELETE SET NULL for new foreign keys, and MS SQL only supports adding one field with a foreign key constraint per related table.

To Reproduce

Add two many-to-one type fields related to the same collection.

Directus Version

v10.13.1

Hosting Strategy

Self-Hosted (Docker Image)

Database

MS SQL 2019 – 2024

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant