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

feat(postgres): allow defining deferred FK constraints #5384

Merged
merged 7 commits into from
Mar 27, 2024

Conversation

DASPRiD
Copy link
Contributor

@DASPRiD DASPRiD commented Mar 27, 2024

This PR adds the option to specify constraints as deferrable for relations.

On OneToOne and ManyToOne relations you can now specify a deferMode property, which can be either not deferrable (default), immediate or deferred. Those are also covered by a new DeferMode enum.

Closes #5306

Copy link

codecov bot commented Mar 27, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 99.71%. Comparing base (0e18346) to head (300caa2).
Report is 1 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff            @@
##           master    #5384    +/-   ##
========================================
  Coverage   99.71%   99.71%            
========================================
  Files         222      222            
  Lines       17049    17061    +12     
  Branches     3967     4195   +228     
========================================
+ Hits        17000    17013    +13     
+ Misses         49       48     -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Member

@B4nan B4nan left a comment

Choose a reason for hiding this comment

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

nice, thanks!

can you please also test schema diffing? either in the test you added or by updating this one:

https://github.com/mikro-orm/mikro-orm/blob/master/tests/features/schema-generator/fk-diffing.postgres.test.ts

DASPRiD and others added 4 commits March 27, 2024 13:02
…ostgres.test.ts

Co-authored-by: Martin Adámek <banan23@gmail.com>
…ostgres.test.ts

Co-authored-by: Martin Adámek <banan23@gmail.com>
…ostgres.test.ts

Co-authored-by: Martin Adámek <banan23@gmail.com>
@DASPRiD DASPRiD requested a review from B4nan March 27, 2024 12:37
@B4nan B4nan changed the title feat: add deferred constraints feat(postgres): allow defining deferred FK constraints Mar 27, 2024
@B4nan B4nan merged commit f42d171 into mikro-orm:master Mar 27, 2024
11 checks passed
@B4nan
Copy link
Member

B4nan commented Mar 27, 2024

all right, thanks again!

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

Successfully merging this pull request may close these issues.

Support deferrable constraints for SQL
2 participants