# Generated by Django 3.2.6 on 2021-08-04 12:36

from django.db import migrations, models
import django.db.models.deletion
import orders.models


def set_fields_to_non_null(apps, schema_editor):
    Product = apps.get_model("orders", "Product")
    for product in Product.objects.filter(icon=None):
        product.icon = ""
        product.save()


class Migration(migrations.Migration):

    dependencies = [
        ('users', '0003_alter_profile_association'),
        ('associations', '0001_initial'),
        ('orders', '0003_order_user_association'),
    ]

    operations = [
        migrations.RunPython(set_fields_to_non_null, migrations.RunPython.noop),
        migrations.AlterField(
            model_name='order',
            name='product',
            field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='orders', to='orders.product', validators=[orders.models.available_product_filter]),
        ),
        migrations.AlterField(
            model_name='order',
            name='shift',
            field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='orders', to='orders.shift'),
        ),
        migrations.AlterField(
            model_name='order',
            name='user',
            field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, related_name='orders', to='users.user'),
        ),
        migrations.AlterField(
            model_name='order',
            name='user_association',
            field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='orders', to='associations.association'),
        ),
        migrations.AlterField(
            model_name='product',
            name='icon',
            field=models.CharField(blank=True, default='', help_text='Font-awesome icon name that is used for quick display of the product type.', max_length=20),
        ),
        migrations.AlterField(
            model_name='shift',
            name='venue',
            field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='shifts', to='orders.ordervenue', validators=[orders.models.active_venue_validator]),
        ),
    ]
