Rename also columns in history table when renaming columns

Closes #14561
(grafted from 14e25c1bddddbe51ddbae31e3dd6b4cec72d49f5)

--HG--
branch : 7.0
This commit is contained in:
Maxime Richez
2026-03-14 18:09:29 +01:00
parent 70698ca24f
commit c79be09c94
2 changed files with 11 additions and 0 deletions
@@ -26,6 +26,7 @@ class TableHandler(TableHandlerInterface):
self.__constraints = None
self.__fk_deltypes = None
self.__indexes = None
self._model = model
transaction = Transaction()
cursor = transaction.connection.cursor()
@@ -165,6 +166,11 @@ class TableHandler(TableHandlerInterface):
Identifier(old_name),
Identifier(new_name)))
self._update_definitions(columns=True)
if not self.history:
history_table = self.table_name + '__history'
if self.__class__.table_exist(history_table):
history_h = self.__class__(self._model, True)
history_h.column_rename(old_name, new_name)
else:
logger.warning(
'Unable to rename column %s on table %s to %s.',
+5
View File
@@ -122,6 +122,11 @@ class TableHandler(TableHandlerInterface):
self._update_definitions(columns=True)
else:
self._recreate_table({old_name: {'name': new_name}})
if not self.history:
history_table = self.table_name + '__history'
if self.__class__.table_exist(history_table):
history_h = self.__class__(self._model, True)
history_h.column_rename(old_name, new_name)
else:
logger.warning(
'Unable to rename column %s on table %s to %s.',