-
Notifications
You must be signed in to change notification settings - Fork 45
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
[FIX] util/records: fix delete_unused
DOCSTRING
#98
base: master
Are you sure you want to change the base?
Conversation
upgradeci skip |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could also mention that it does not handle indirect references.
If table 1 is referenced with ON DELETE CASCADE by table 2 and table 2 is restricted by table 3, the upgrade would crash.
I'm trying to fix this in addition to some other cases, but it's a bit tricky
I thought that it's somewhat implied that if there's no direct link in the database, the record won't be removed :p The term "used" is used in the sense that there is a constraint linking one record to another. Imho what would be more important to mention is what Yazid said. |
That's a good idea, I will add a warning.
This is right and I will clarify it in the DOCSTRING. However, I think we should consider addressing this: the behavior sounds to be inconsistent when we have a
But well if @UemuS manages to solve the indirect issue, this inconsistency will also be gone, just wanted to acknowledge it.
Exactly! And that's the problem with the name/DOCSTRING: they don't explain that records will still be removed if their references can cascade. |
5c481a4
to
00b29ae
Compare
upgradeci skip |
`delete_unused`, in spite of its name, deletes records even if they are used, provided they are not part of a foreign key with `restrict` or `set` ondelete clause (iow: allowing for cascading foreign keys).
00b29ae
to
0675a6a
Compare
delete_unused
, in spite of its name, deletes records even if they are used, provided they are not part of a foreign key withrestrict
ondelete clause.