[FIX] registry: avoid dropping indexes
When an index has name 'tablename_fieldname_index', this index is dropped if the field has index=False. This lead to dropping a user-created index or dropping/recreating the index when index=True is set in a dependent module. Some info is logged instead. closes odoo/odoo#67602 X-original-commit: 6a87318df296a11e3300723ca0c8b49c0dcf5fa7 Signed-off-by: Raphael Collet (rco) <rco@openerp.com>
This commit is contained in:
committed by
Raphael Collet
parent
5fa1256bb6
commit
b404ae6a55
@@ -452,7 +452,7 @@ class Registry(Mapping):
|
||||
except psycopg2.OperationalError:
|
||||
_schema.error("Unable to add index for %s", self)
|
||||
elif not index and indexname in existing:
|
||||
sql.drop_index(cr, indexname, tablename)
|
||||
_schema.info("Keep unexpected index %s on table %s", indexname, tablename)
|
||||
|
||||
def add_foreign_key(self, table1, column1, table2, column2, ondelete,
|
||||
model, module, force=True):
|
||||
|
||||
Reference in New Issue
Block a user