Skip to content
Snippets Groups Projects
Commit f7c45c5e authored by Martin Trigaux's avatar Martin Trigaux
Browse files

[FIX] base: do not drop sql constraints during update

When a module is updated, the sql constraints were checked against postgres pg_get_constraintdef() to see if they have diverged from the one defined in python code.
However this check was failing as the syntax returned by pg_get_constraintdef() (e.g. "CHECK ((credit * debit) = 0::numeric)") differs from the one returned by `unify_cons_text` method (e.g. "check(debit*credit = 0")) so the constraints were always dropped and recomputed.
This adds a definition column on ir.model.constraint (storing original defintion) to detect changes.
The pg_constraint is still inspected to make sure we detect constraint without ir_model_constraint but with postgres constraint defined (e.g. name_uniq defined in base.sql).

This changes also the date_update field when the definition changes.
parent a1ab1244
No related branches found
No related tags found
No related merge requests found
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment