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

Delete field only after foreign key constraints are removed #13222

Merged

Conversation

licitdev
Copy link
Member

@licitdev licitdev commented May 11, 2022

Fix field deletion issue when the field is referenced by a foreign key constraint.
The dropping of the field now occurs only after the constraints are removed.
Issue exists for mysql, maria and mssql.

Closes #12478.

@azrikahar
Copy link
Contributor

I believe this should be related to #12478

@licitdev
Copy link
Member Author

I believe this should be related to #12478

Yes, tested and it does resolve that issue. Thanks!

@rijkvanzanten
Copy link
Member

And can we add an e2e test for this too? 🙂

Copy link
Member

@rijkvanzanten rijkvanzanten left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@licitdev @azrikahar can you check if this doesn't break on CockroachDB? You can't do regular delete/inserts before a DDL statement in a transactions in CRDB, so this might go 💥 there

@licitdev
Copy link
Member Author

@rijkvanzanten The tests for creation and deletion of fields through API are included in the black box testing.
Please refer to the tests code and results below.

Test Results Before & After PR

Before: https://github.com/directus/directus/runs/6384350766
After: https://github.com/directus/directus/runs/6389571685

Screenshot 2022-05-11 at 10 25 42 PM Screenshot 2022-05-11 at 10 25 47 PM

@rijkvanzanten rijkvanzanten added this to the v9-next milestone May 11, 2022
@rijkvanzanten rijkvanzanten merged commit e004b0d into directus:main May 11, 2022
@licitdev licitdev deleted the fix/delete-field-fk-constraint branch May 11, 2022 15:41
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 2, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Cannot delete M2O field
3 participants