This question has been flagged
1 Reply
5948 Views

The OpenERP 6.1 developer book section on ORM fields documents the _sql_constraints field attribute by saying "See the SQL constraints section for further details". Where is this section? I cannot find it.

Thank you Jeremy for your answer. This example in the tutorial is good to see, but I'm still in the dark about things like:

Of the three-part tuple put into the _sql_constraints list: (name, condition, description), is the condition executed as part of a SQL command something like 'ALTER TABLE ADD CONSTRAINT {name} {condition}'? Knowing this would help us to know things like whether this is a good place to add indices to tables (presumably not.)

Is the generated SQL executed just on module creation, or can we add constraints to a module which is just being updated? If we modify the constraint in _sql_constraints, does the old constraint get dropped and the new one created when we update the module?

Avatar
Discard
Best Answer

Hello,

You can find documentation here : https://www.odoo.com/documentation/8.0/howtos/backend.html#model-constraints

Using PostgreSQL constraints doc : http://www.postgresql.org/docs/9.3/static/ddl-constraints.html

 

 

Avatar
Discard