Contributors mailing list archives
contributors@odoo-community.org
Browse archives
Re: pre-commit changes
Re: Candidature pour un poste en Alternance – Bachelor Concepteur développeurd’applications
Migration 12.0 -> 13.0 and field collision
by
DEC, Yann Papouin
Hi,
I'm starting a migration process for a copy of our production database and it fails on the following error (detailed log attached):
ERROR mig_9008 odoo.sql_db: bad query:
UPDATE ir_model_fields
SET name = 'notified_partner_ids'
WHERE name = 'needaction_partner_ids'
AND model = 'mail.message'
UPDATE ir_model_fields
SET name = 'notified_partner_ids'
WHERE name = 'needaction_partner_ids'
AND model = 'mail.message'
ERROR: duplicate key value violates unique constraint "ir_model_fields_name_unique"
DETAIL: Key (model, name)=(mail.message, notified_partner_ids) already exists.
DETAIL: Key (model, name)=(mail.message, notified_partner_ids) already exists.
ERROR mig_9008 OpenUpgrade: mail: error in migration script mail/migrations/13.0.1.0/pre-migration.py: duplicate key value violates unique constraint "ir_model_fields_name_unique"
I tracked down the issue and I found out that the `notified_partner_ids` field was an existing field added in 7.0 but deleted in 9.0.
Maybe this field should have been dropped or renamed to `openupgrade_legacy_xxx`, I don't know if it should be the case or if I made a mistake in my original upgrade path, but this field still exists in our database even if not referenced in any files.
Whatever, if you are in my case, I made a PR to identify and remove orphaned fields (for the database_cleanup module):
For the record, we have more than 1000 orphaned fields (list attached) in our production database (updated from 6.1 -> 7.0 -> 8.0 -> 9.0 -> 10.0 -> 11.0 in october 2020)
--
![]() |
Yann PAPOUIN Ingénieur R&D |
![]() |
|
|||||||||||||||
|
![]() |