Migration fix (response is different for postgresql)

This commit is contained in:
Oliver Walters 2021-02-03 13:02:28 +11:00
parent 793e5b820e
commit 0e246a7fdf
3 changed files with 8 additions and 8 deletions

View File

@ -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)

View File

@ -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!

View File

@ -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!