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

Foreign Key Constraints ✨ #5615

Merged
merged 64 commits into from
May 19, 2021
Merged

Foreign Key Constraints ✨ #5615

merged 64 commits into from
May 19, 2021

Conversation

rijkvanzanten
Copy link
Member

@rijkvanzanten rijkvanzanten commented May 11, 2021

  • Adds database mirroring for foreign key constraints
  • Updates relational structure to match collections/fields with schema/meta split
  • Adds on-delete trigger support for database native foreign keys
  • Adds on-deselect "api trigger" for one-to-many deselects

closes #2942
closes #3311
closes #3361
closes #3664
closes #4245
fixes #5493
fixes #5528
fixes #5650
fixes #5749
ref #5070

@rijkvanzanten rijkvanzanten linked an issue May 19, 2021 that may be closed by this pull request
@rijkvanzanten rijkvanzanten marked this pull request as ready for review May 19, 2021 16:08
@rijkvanzanten rijkvanzanten merged commit 9335372 into main May 19, 2021
@rijkvanzanten rijkvanzanten deleted the relations branch May 19, 2021 16:29
Oreilles added a commit to Oreilles/directus that referenced this pull request May 27, 2021
AustinPhillipTaylor pushed a commit to AustinPhillipTaylor/directus that referenced this pull request May 11, 2022
* Bump knex-schema-inspector

* Fix cli role name attr

* Update relation type

* Restructure relations

* Restructure relations table

* Update api type for relation record

* Fetch relations in new structure

* Update schema-inspector

* Use new relations schema structure in api

* Update relations GETters

* Add default value to one deselect

* Add create relationship on existing field

* Add updating existing relationship

* Add delete relations

* Add relations query resolver

* Add graphql mutations for relations

* Fix reading from wrong name

* Fix wrong method name

* No idea why this flip flops every install

* Update relation type

* Accept null in use-collection composable

* Use new relations structure in translations

* Use new relations structure in new-collection

* Start updating field detail store

* Renames for new relations structure

* Silently ignore passed collection/field in relation update

* Fix setting pk field in m2o relational setup

* Small tweaks in o2m setup

* Fix m2m setup

* Tweak m2o setup

* Fix m2a setup

* Allow null for related collection (m2a)

* Fix languages code name

* Fix migration default value

* Fix relational cleanup in collections/fields

* Fix transaction problem in field delete

* Fix inserting relational o2m items

* Don't execute updateByQuery on empty item set

Fixes directus#5710, fixes directus#5070

* Show referential action input on m2o

* Finish language for m2o

* Show triggers config on o2m

* Delete items on one_deselect_item delete

* Fix naming, show relational trigger config on m2m

* Tweak language, add setup to m2a

* Fix linter warnings

* Add trigger setup for translations

* fix Edit non-schema relationship issue

* Sync existing on_delete triggers in o2m setup

* Add migration to setup foreign key constraints

* Update illegal FK values before setting constraint

* Fix MySQL unsigned vs not-unsigned in FK creation

* Use pretty names for labels in relational triggers

* Prefix auto-junction when system table

Fixes directus#5493

* Add system foreign key triggers

Fixes directus#5749

* Update docs
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 5, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.