# Generated by Django 3.2.18 on 2023-05-17 05:10

from django.db import migrations, models
from django.db.models import F

SOURCE_WEB = 0
def drop_autogenerated_web_shift_name(apps, schema_editor):
    CustomOnCallShift = apps.get_model('schedules', 'CustomOnCallShift')
    CustomOnCallShift.objects.filter(source=SOURCE_WEB).update(name=None)

def autogenerate_web_shift_name(apps, schema_editor):
    CustomOnCallShift = apps.get_model('schedules', 'CustomOnCallShift')
    shifts_from_web = CustomOnCallShift.objects.filter(source=SOURCE_WEB)
    shifts_from_web.update(name=F("public_primary_key"))  # set some uniq name to make migration reversible



class Migration(migrations.Migration):

    dependencies = [
        ('schedules', '0012_auto_20230502_1259'),
    ]

    operations = [
        migrations.AlterUniqueTogether(
            name='customoncallshift',
            unique_together=set(),
        ),
        migrations.RemoveField(
            model_name='customoncallshift',
            name='title',
        ),
        migrations.AlterField(
            model_name='customoncallshift',
            name='name',
            field=models.CharField(default=None, max_length=200, null=True),
        ),
        migrations.RunPython(drop_autogenerated_web_shift_name, autogenerate_web_shift_name),
    ]
