Patches from ingesdata migration:
- Add missing field "company" in product_cost_price register - Add missing sequence rename in table rename function - Change the way we check if a sequence exists Task #159227
This commit is contained in:
parent
a6af9fb3cf
commit
9943decfc1
|
@ -0,0 +1,13 @@
|
|||
diff --git a/tryton/modules/product/product.py b/tryton/modules/product/product.py
|
||||
index e46f608dcb..13d04d0212 100644
|
||||
--- a/tryton/modules/product/product.py
|
||||
+++ b/tryton/modules/product/product.py
|
||||
@@ -806,7 +806,7 @@ class ProductCostPrice(ModelSQL, CompanyValueMixin):
|
||||
# Migration from 4.4: replace template by product
|
||||
if table.column_exist('template'):
|
||||
columns = ['create_uid', 'create_date',
|
||||
- 'write_uid', 'write_date', 'cost_price']
|
||||
+ 'write_uid', 'write_date', 'cost_price', 'company']
|
||||
cursor.execute(*sql_table.insert(
|
||||
columns=[Column(sql_table, c) for c in columns]
|
||||
+ [sql_table.product],
|
|
@ -0,0 +1,24 @@
|
|||
diff --git a/tryton/trytond/trytond/backend/postgresql/database.py b/tryton/trytond/trytond/backend/postgresql/database.py
|
||||
index 3c891d48f3..e5ef92947c 100644
|
||||
--- a/tryton/trytond/trytond/backend/postgresql/database.py
|
||||
+++ b/tryton/trytond/trytond/backend/postgresql/database.py
|
||||
@@ -676,13 +676,12 @@ class Database(DatabaseInterface):
|
||||
|
||||
def sequence_exist(self, connection, name):
|
||||
cursor = connection.cursor()
|
||||
- for schema in self.search_path:
|
||||
- cursor.execute('SELECT 1 '
|
||||
- 'FROM information_schema.sequences '
|
||||
- 'WHERE sequence_name = %s AND sequence_schema = %s',
|
||||
- (name, schema))
|
||||
- if cursor.rowcount:
|
||||
- return True
|
||||
+ cursor.execute('SELECT 1 '
|
||||
+ 'FROM pg_sequences '
|
||||
+ 'WHERE sequencename = %s',
|
||||
+ (name,))
|
||||
+ if cursor.rowcount:
|
||||
+ return True
|
||||
return False
|
||||
|
||||
def sequence_create(
|
6
series
6
series
|
@ -53,3 +53,9 @@ issue12480.diff # [trytond] Support GIN index with btree_gin PostgreSQL extensio
|
|||
merge_request779.diff # [account_payment] Warn when submitting, approving or proceeding payment with reconciled line
|
||||
|
||||
issue12576.diff # [account_stock_eu] Could not find the intrastat countries for moves
|
||||
|
||||
product_cost_price_migration.diff # [product] Add missing column in product_cost_price
|
||||
|
||||
table_rename.diff # [trytond] Add missing sequence rename in table_rename function
|
||||
|
||||
sequence_exist.diff # [trytond] Search sequences using pg_sequences instead of information_schema.sequences
|
||||
|
|
|
@ -0,0 +1,16 @@
|
|||
diff --git a/tryton/trytond/trytond/backend/postgresql/table.py b/tryton/trytond/trytond/backend/postgresql/table.py
|
||||
index e874ee61c0..769f07ccd5 100644
|
||||
--- a/tryton/trytond/trytond/backend/postgresql/table.py
|
||||
+++ b/tryton/trytond/trytond/backend/postgresql/table.py
|
||||
@@ -132,6 +132,11 @@ class TableHandler(TableHandlerInterface):
|
||||
and not cls.table_exist(new_name)):
|
||||
cursor.execute(SQL('ALTER TABLE {} RENAME TO {}').format(
|
||||
Identifier(old_name), Identifier(new_name)))
|
||||
+ # Migrate from 6.6: rename old sequence
|
||||
+ old_sequence = old_name + '_id_seq'
|
||||
+ new_sequence = new_name + '_id_seq'
|
||||
+ transaction.database.sequence_rename(
|
||||
+ transaction.connection, old_sequence, new_sequence)
|
||||
# Rename history table
|
||||
old_history = old_name + "__history"
|
||||
new_history = new_name + "__history"
|
Loading…
Reference in New Issue