24 lines
640 B
Python
24 lines
640 B
Python
|
# Generated by Django 5.1.3 on 2025-01-07 20:17
|
||
|
|
||
|
from django.db import migrations
|
||
|
|
||
|
|
||
|
def migrate_edition_to_editions_temp(apps, schema_editor):
|
||
|
Purchase = apps.get_model("games", "Purchase")
|
||
|
for purchase in Purchase.objects.all():
|
||
|
if purchase.edition:
|
||
|
purchase.editions_temp.add(purchase.edition)
|
||
|
purchase.save()
|
||
|
else:
|
||
|
print(f"No edition found for Purchase {purchase.id}")
|
||
|
|
||
|
|
||
|
class Migration(migrations.Migration):
|
||
|
dependencies = [
|
||
|
("games", "0042_purchase_editions_temp"),
|
||
|
]
|
||
|
|
||
|
operations = [
|
||
|
migrations.RunPython(migrate_edition_to_editions_temp),
|
||
|
]
|