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

[11.0] sql constraints cannot be overwritten #28914

Closed
wants to merge 2 commits into from

Conversation

etobella
Copy link
Contributor

Description of the issue/feature this PR addresses:
I have detected some issues that the system is dropping, creating and sometime failing creating indexes when I update modules and my system is rewriting the sql constraints.

Current behavior before PR:
When an installed module rewrites an sql constraint, every time you update any module, the index will be dropped, then created with the original definition, dropped again and created with the new definition.

Desired behavior after PR is merged:
When a module rewrites an sql constraint, the index will be dropped and created with the new definition only if the module is affected.

@rco-odoo @jbeficent

--
I confirm I have signed the CLA and read the PR guidelines at www.odoo.com/submit-pr

@robodoo robodoo added the CI 🤖 Robodoo has seen passing statuses label Nov 21, 2018
@etobella
Copy link
Contributor Author

This PR solves the issue #25661

@MiquelRForgeFlow
Copy link
Contributor

Could it be done in v10 instead?

@JordiBForgeFlow
Copy link
Contributor

@mreficent why would you want to do that? Before putting more efforts let's wait until odoo takes action

@nhomar
Copy link
Collaborator

nhomar commented Nov 21, 2018

what i do is create a migration script when I change an sql contraint, change sql constraints is in geenral a bad practice BTW... but I do not know if you have a use case where it isn't

@etobella
Copy link
Contributor Author

A migration script will not work. When you update any module, the constrain will be rewritten, as the definition is not matched.

You may want to change a constraint because it is too restrictive and you want to add new fields on the constraint.

@etobella etobella changed the title 11.0 sql constraints [11.0] sql constraints cannot be overwritten Nov 28, 2018
@C3POdoo C3POdoo added the CLA Contributor License Agreement label Dec 20, 2019
@C3POdoo C3POdoo added the ORM ORM, python Framework related label Dec 31, 2019
@MiquelRForgeFlow
Copy link
Contributor

MiquelRForgeFlow commented Feb 12, 2020

@etobella I think this has been implemented in v13 with f8e37d6. Can you check?

@etobella
Copy link
Contributor Author

Yes, thanks!

@etobella etobella closed this Jun 30, 2020
@robodoo robodoo added closed 💔 and removed CI 🤖 Robodoo has seen passing statuses labels Jun 30, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Contributor License Agreement ORM ORM, python Framework related
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants