Nicolas Évrard pushed to branch branch/default at Tryton / Tryton


Commits:
1ab5527d by Nicolas Évrard at 2023-04-05T19:36:27+02:00
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
- - - - -


1 changed file:

- trytond/trytond/backend/postgresql/table.py


Changes:

=====================================
trytond/trytond/backend/postgresql/table.py
=====================================
@@ -109,6 +109,9 @@
         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)



View it on Heptapod: 
https://foss.heptapod.net/tryton/tryton/-/commit/1ab5527da66025c407bb0e3b563487753b79208c

-- 
View it on Heptapod: 
https://foss.heptapod.net/tryton/tryton/-/commit/1ab5527da66025c407bb0e3b563487753b79208c
You're receiving this email because of your account on foss.heptapod.net.


Reply via email to