Repository navigation
feat: add deferrable support to exclusion decorator to mirror unique and index decorators - #11802
Conversation
PR Reviewer Guide 🔍Here are some key observations to aid the review process:
|
|
@G0maa FYI :) |
PR Code Suggestions ✨Latest suggestions up to cb1baac
Previous suggestionsSuggestions up to commit 30fe0fc
Suggestions up to commit 1a043f9
Suggestions up to commit feef102
Suggestions up to commit 0eba2d3
Suggestions
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||
G0maa
left a comment
There was a problem hiding this comment.
What happens if an @Exclusion changes across migrations? (i.e. does it get dropped?)
|
And yeah, what about migrations? What will happen when I change |
commit: |
|
Regarding migrations: as i was working on the feature I noticed that changing ONLY the deferrable value (or removing it) after the exclusion was already created does not change it in the db. I tested it on the |
PR Code Suggestions ✨
|
|||||||||
|
In order to properly fix the tests, it needs to be known:
|
|
I would also add the check against allowlist at runtime as qodo suggests. @alumni what do you think? |
At least in TypeORM, only the PostgresDriver implements exclusion constraints. Not sure if there are other DBs supporting them, they seem to be overlapping in functionality with other constraints.
Quite a lot of DBs support deferrable constraints and a lot of our drivers support them too. If it's supported for e.g. referential constraints (FKs), it should be supported for unique constraints and check constraints too.
I would say it's not really necessary since it's validated by TypeScript types, so you'd have to cast, which means you have to really want to do something different. It's not validated for other types of constraints either. |
|
I will summaries why the tests keep failing and 2 possible solutions: the tests failed for the first time because i tried to use 2 possible ways to fix the tests:
IMO option 1 is the better one, tell me what you think @OSA413. |
Yes, I think this is also better |
Done :) |
|
Why CI fails: tl;dr the title contains upper-case characters. |
|
fixed @G0maa |
Code Review by Qodo (Alpha)(Review updated until commit cb1baac)
1. Missing deferrable in constraint loading query
|
gioboa
left a comment
There was a problem hiding this comment.
It looks good to me, can we update docs as well please?
|
Hi @gioboa, not sure how to update the docs. Also, shouldn't i fix the first 2 bugs found by Qodo in the review? |
|
Yep, please have a look at the suggestions if those are correct or not. |
|
Persistent review updated to latest commit cb1baac |
|
Well i fixed the first bug but the other ones seems to exist for other decorators as well ( |
…and index decorators (typeorm#11802)
…and index decorators (typeorm#11802)
User description
Add deferrable support to @exclusion decorator (mirror @unique & @Index), as described in #11793
Pull-Request Checklist
masterbranchFixes #00000