From 4301c56033da1fca9782b0bb3f01f84155154a75 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20=C3=89vrard?= Date: Wed, 5 Apr 2023 19:36:27 +0200 Subject: [PATCH] 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 --- trytond/trytond/backend/postgresql/table.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/trytond/trytond/backend/postgresql/table.py b/trytond/trytond/backend/postgresql/table.py index e3bef8c247..fd6ee28421 100644 --- a/trytond/trytond/backend/postgresql/table.py +++ b/trytond/trytond/backend/postgresql/table.py @@ -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)