-
Notifications
You must be signed in to change notification settings - Fork 78
[FIX] pg: rename m2m field meta data #343
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
base: master
Are you sure you want to change the base?
Conversation
|
upgradeci retry with always only base |
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.
Better check if there isn't any xmlid for the field under the available modules (standard_modules usual trick)
230c1ff to
eef47dd
Compare
When renaming a model and updating related m2m fields, the relation table and its columns are renamed but only manual fields meta data is updated, assuming that base fields will be updated when the module loads. The custom modules meta data should also be updated if the tables were updated.
eef47dd to
220fed7
Compare
| AND ( | ||
| f.state = 'manual' | ||
| OR d.model = 'ir.model.fields' | ||
| AND d.res_id = f.id | ||
| AND d.module NOT IN %s | ||
| ) |
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.
| AND ( | |
| f.state = 'manual' | |
| OR d.model = 'ir.model.fields' | |
| AND d.res_id = f.id | |
| AND d.module NOT IN %s | |
| ) | |
| AND ( f.state = 'manual' | |
| OR (d.model = 'ir.model.fields' | |
| AND d.res_id = f.id | |
| AND d.module NOT IN %s) | |
| ) |
Even with formatted this query looks hard to understand. Wouldn't it be better if we just do a cte?
WITH to_upd (
SELECT f.id
FROM ir_model_fields f
JOIN ir_model_data d
ON d.model = 'ir.model.fields'
AND d.res_id = f.id
WHERE f.relation_table = %s
AND ( f.state = 'manual'
OR d.module NOT IN %s)
) UPDATE ...

When renaming a model and updating related m2m fields, the relation table and its columns are renamed but only manual fields meta data is updated, assuming that base fields will be updated when the module loads.
The custom modules meta data should also be updated if the tables were updated.
upg-3176133