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

add missing cyclic relations #158

Merged
merged 1 commit into from
Mar 4, 2024
Merged

Conversation

sjib
Copy link
Contributor

@sjib sjib commented Feb 10, 2024

should solve #107

@sjib sjib added bug Something isn't working datamodel Concerns the datamodel labels Feb 10, 2024
@sjib sjib self-assigned this Feb 10, 2024
@sjib
Copy link
Contributor Author

sjib commented Feb 10, 2024

@3nids Are these the right options for a cyclic relation?
ON UPDATE CASCADE ON DELETE SET NULL DEFERRABLE INITIALLY DEFERRED

@ponceta
Copy link
Member

ponceta commented Feb 13, 2024

@ponceta check the defferable setting with @3nids before merging this.

@ponceta
Copy link
Member

ponceta commented Feb 20, 2024

The differences between DEFERRABLE INITIALLY DEFERRED, DEFERRABLE INITIALLY IMMEDIATE and NOT DEFERRABLE are as follows:

  • DEFERRABLE INITIALLY DEFERRED means that the constraint is deferred until the end of the transaction, unless the SET CONSTRAINTS command is used to make it immediate.
  • DEFERRABLE INITIALLY IMMEDIATE means that the constraint is checked at the end of each instruction, unless the SET CONSTRAINTS command is used to make it deferred.
  • NOT DEFERRABLE means that the constraint is always checked at the end of each instruction, and that the SET CONSTRAINTS command cannot be used to modify it.

In summary, DEFERRABLE and NOT DEFERRABLE indicate whether the constraint can be deferred or not, and INITIALLY DEFERRED and INITIALLY IMMEDIATE indicate the default checking mode for the constraint.

@sjib, @3nids, @cymed, @domi4484 for TEKSI would you be OK to use the DEFERRABLE INITIALLY DEFERRED for every relation connecting objects with each other in the database? (at least where it makes sense, so we can set it once and for all for the database)

@domi4484
Copy link
Contributor

For what concerns the import/export is ok.

@sjib
Copy link
Contributor Author

sjib commented Feb 26, 2024

@ponceta Good for me - please merge this and #156 I will create a version with DEFERRABLE INITIALLY DEFERRED in a new pull request based on the updated master.

@ponceta ponceta closed this Mar 4, 2024
@ponceta ponceta reopened this Mar 4, 2024
@ponceta ponceta merged commit df6ee39 into main Mar 4, 2024
11 checks passed
@ponceta ponceta deleted the datamodel-add-missing-cyclic-relations branch March 4, 2024 14:38
@ponceta ponceta mentioned this pull request Mar 4, 2024
@sjib
Copy link
Contributor Author

sjib commented Mar 4, 2024

@ponceta Good for me - please merge this and #156 I will create a version with DEFERRABLE INITIALLY DEFERRED in a new pull request based on the updated master.

@ponceta Here the additional pull request: #178

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working datamodel Concerns the datamodel
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants