Drop default on id column of history tables

The migration introduced in baa87cf1a343 would fail because previous migration
would have wrongly set a default value in id column of history tables

Closes #12186
This commit is contained in:
Nicolas Évrard
2023-04-05 19:36:27 +02:00
parent 23304fc2e0
commit 4301c56033
@@ -109,6 +109,9 @@ class TableHandler(TableHandlerInterface):
elif self.history:
if not self.__columns['__id']['identity']:
update_definitions = True
cursor.execute(
SQL("ALTER TABLE {} ALTER COLUMN id DROP DEFAULT").format(
Identifier(self.table_name)))
migrate_to_identity(self.table_name, '__id')
if update_definitions:
self._update_definitions(columns=True)