Skip to content

Commit

Permalink
fix(Prices): init Price.receipt_quantity field in migration. ref #498
Browse files Browse the repository at this point in the history
  • Loading branch information
raphodn committed Oct 18, 2024
1 parent 857b813 commit 1822b8d
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions open_prices/prices/migrations/0003_price_receipt_quantity.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,13 @@
from django.db import migrations, models


def init_receipt_quantity(apps, schema_editor):
Price = apps.get_model("prices", "Price")
Price.objects.filter(
proof__type__in=["RECEIPT", "GDPR_REQUEST"], receipt_quantity=None
).update(receipt_quantity=1)


class Migration(migrations.Migration):
dependencies = [
("prices", "0002_alter_price_currency"),
Expand All @@ -20,4 +27,5 @@ class Migration(migrations.Migration):
verbose_name="Receipt's price quantity (user input)",
),
),
migrations.RunPython(init_receipt_quantity),
]

0 comments on commit 1822b8d

Please sign in to comment.