# Generated by Django 4.2.26 on 2025-11-24 11:32

from django.db import migrations, models


class Migration(migrations.Migration):

    dependencies = [
        ("pretixbase", "0299_itemprogramtime_location"),
    ]

    operations = [
        migrations.AddField(
            model_name="reusablemedium",
            name="claim_token",
            field=models.CharField(max_length=200, null=True),
        ),
        migrations.AddField(
            model_name="reusablemedium",
            name="label",
            field=models.CharField(max_length=200, null=True),
        ),
        # use temporary related_name "linked_mediums" for ManyToManyField, so we can migrate existing data
        migrations.AddField(
            model_name="reusablemedium",
            name="linked_orderpositions",
            field=models.ManyToManyField(
                related_name="linked_mediums", to="pretixbase.orderposition"
            ),
        ),
        migrations.RunSQL(
            sql="INSERT INTO pretixbase_reusablemedium_linked_orderpositions (reusablemedium_id, orderposition_id) SELECT id, linked_orderposition_id FROM pretixbase_reusablemedium WHERE linked_orderposition_id IS NOT NULL;",
            reverse_sql="DELETE FROM pretixbase_reusablemedium_linked_orderpositions;",
        ),
    ]
