From 0e246a7fdfb68335942deb8144d67c64677e2fc3 Mon Sep 17 00:00:00 2001 From: Oliver Walters Date: Wed, 3 Feb 2021 13:02:28 +1100 Subject: [PATCH] Migration fix (response is different for postgresql) --- .../company/migrations/0019_auto_20200413_0642.py | 12 ++++++------ .../company/migrations/0026_auto_20201110_1011.py | 2 +- InvenTree/part/migrations/0056_auto_20201110_1125.py | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/InvenTree/company/migrations/0019_auto_20200413_0642.py b/InvenTree/company/migrations/0019_auto_20200413_0642.py index deda87a040..a27f56ce3a 100644 --- a/InvenTree/company/migrations/0019_auto_20200413_0642.py +++ b/InvenTree/company/migrations/0019_auto_20200413_0642.py @@ -23,7 +23,7 @@ def reverse_association(apps, schema_editor): cursor = connection.cursor() response = cursor.execute("select id, MPN from part_supplierpart;") - supplier_parts = response.fetchall() + supplier_parts = cursor.fetchall() # Exit if there are no SupplierPart objects # This crucial otherwise the unit test suite fails! @@ -42,7 +42,7 @@ def reverse_association(apps, schema_editor): manufacturer_id = None - row = response.fetchone() + row = cursor.fetchone() if len(row) > 0: try: @@ -59,7 +59,7 @@ def reverse_association(apps, schema_editor): # Now extract the "name" for the manufacturer response = cursor.execute(f"SELECT name from company_company where id={manufacturer_id};") - row = response.fetchone() + row = cursor.fetchone() name = row[0] @@ -106,7 +106,7 @@ def associate_manufacturers(apps, schema_editor): cursor = connection.cursor() response = cursor.execute("select id, MPN from part_supplierpart;") - supplier_parts = response.fetchall() + supplier_parts = cursor.fetchall() # Exit if there are no SupplierPart objects # This crucial otherwise the unit test suite fails! @@ -166,7 +166,7 @@ def associate_manufacturers(apps, schema_editor): # Extract the company back from the database response = cursor.execute(f"select id from company_company where name='{company_name}';") - row = response.fetchone() + row = cursor.fetchone() manufacturer_id = int(row[0]) # Map both names to the same company @@ -318,7 +318,7 @@ def associate_manufacturers(apps, schema_editor): # Extract all SupplierPart objects from the database cursor = connection.cursor() response = cursor.execute("select id, MPN, SKU, manufacturer_id, manufacturer_name from part_supplierpart;") - results = response.fetchall() + results = cursor.fetchall() part_count = len(results) diff --git a/InvenTree/company/migrations/0026_auto_20201110_1011.py b/InvenTree/company/migrations/0026_auto_20201110_1011.py index 1202fbe7f7..553eced0fc 100644 --- a/InvenTree/company/migrations/0026_auto_20201110_1011.py +++ b/InvenTree/company/migrations/0026_auto_20201110_1011.py @@ -106,7 +106,7 @@ def reverse_currencies(apps, schema_editor): # For each currency code in use, check if we have a matching Currency object for code in codes_in_use: response = cursor.execute(f"SELECT id, suffix from common_currency where suffix='{code}';") - row = response.fetchone() + row = cursor.fetchone() if row is not None: # A match exists! diff --git a/InvenTree/part/migrations/0056_auto_20201110_1125.py b/InvenTree/part/migrations/0056_auto_20201110_1125.py index 3e4572b518..13a512bdd0 100644 --- a/InvenTree/part/migrations/0056_auto_20201110_1125.py +++ b/InvenTree/part/migrations/0056_auto_20201110_1125.py @@ -106,7 +106,7 @@ def reverse_currencies(apps, schema_editor): # For each currency code in use, check if we have a matching Currency object for code in codes_in_use: response = cursor.execute(f"SELECT id, suffix from common_currency where suffix='{code}';") - row = response.fetchone() + row = cursor.fetchone() if row is not None: # A match exists!