mirror of
https://github.com/ae-utbm/sith.git
synced 2025-04-16 02:50:22 +00:00
remove data migration in migration 0030 of counter
This commit is contained in:
parent
c527e87fd1
commit
b8a40027b8
@ -1,23 +1,7 @@
|
||||
# Generated by Django 4.2.17 on 2025-03-05 14:03
|
||||
|
||||
import django.db.models.deletion
|
||||
from django.conf import settings
|
||||
from django.db import migrations, models
|
||||
from django.db.migrations.state import StateApps
|
||||
|
||||
|
||||
def migrate_cons_balances(apps: StateApps, schema_editor):
|
||||
ReturnableProduct = apps.get_model("counter", "ReturnableProduct")
|
||||
Product = apps.get_model("counter", "Product")
|
||||
|
||||
cons = Product.objects.filter(pk=settings.SITH_ECOCUP_CONS).first()
|
||||
dcons = Product.objects.filter(pk=settings.SITH_ECOCUP_DECO).first()
|
||||
if not cons or not dcons:
|
||||
return
|
||||
returnable = ReturnableProduct.objects.create(
|
||||
product=cons, returned_product=dcons, max_return=settings.SITH_ECOCUP_LIMIT
|
||||
)
|
||||
returnable.update_balances()
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
@ -119,8 +103,5 @@ class Migration(migrations.Migration):
|
||||
name="returnable_product_unique_type_per_customer",
|
||||
),
|
||||
),
|
||||
migrations.RunPython(
|
||||
migrate_cons_balances, reverse_code=migrations.RunPython.noop, elidable=True
|
||||
),
|
||||
migrations.RemoveField(model_name="customer", name="recorded_products"),
|
||||
]
|
||||
|
Loading…
x
Reference in New Issue
Block a user