Fix: Upgrade failed when multiple skus

This commit is contained in:
Amritanshu Agrawal 2021-11-02 14:15:00 +05:30
parent 49aaa2fbe3
commit 7a5ccdfbbb

View File

@ -37,7 +37,9 @@ def upgrade():
column("fraction_units", Unicode(255)),
)
op.execute(
product.update().values(fraction_units=select(sku.c.fraction_units).where(sku.c.product_id == product.c.id))
product.update().values(
fraction_units=select(sku.c.fraction_units).where(sku.c.product_id == product.c.id).limit(1)
)
)
op.drop_index("unique_true_is_default", table_name="stock_keeping_units")