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] validate_fk_constraints function #382

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

thomaspaulb
Copy link
Contributor

This is useful in cases where you need to delete a lot of records, and you speed the deletion up by disabling FK triggers, but you want to validate integrity after deletion.

Sample use:

env.cr.execute('alter table res_partner disable trigger all')
env.cr.execute(delete from res_partner where id = 738152')
validate_fk_constraints(env.cr, 'res_partner', 'id')
# of course this will fail, so then you can iterate until referential integrity is achieved again

This is useful in cases where you need to delete a lot of records,
and you speed the deletion up by disabling FK triggers,
but you want to validate integrity after deletion.
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.

1 participant