# Generated by Django 4.2.6 on 2024-01-30 11:23

from django.db import migrations
import wcd_envoyer.contrib.scheduled.models
import wcd_envoyer.utils.models


class Migration(migrations.Migration):
    dependencies = [
        ('wcd_envoyer_scheduled', '0001_initial'),
    ]

    operations = [
        migrations.AddField(
            model_name='eventavailability',
            name='events',
            field=wcd_envoyer.contrib.scheduled.models.ChoiceArrayField(base_field=wcd_envoyer.utils.models.DynamicChoicesField(choices=[], max_length=512), default=list, size=None, verbose_name='Events'),
            preserve_default=False,
        ),
        migrations.RunSQL("""
UPDATE
    wcd_envoyer_scheduled_eventavailability source
SET
    events = array_append(ARRAY[]::text[], subq.event)
FROM
(
    SELECT id, event from wcd_envoyer_scheduled_eventavailability
) as subq
WHERE
    source.id = subq.id
;
"""),
        migrations.RemoveField(
            model_name='eventavailability',
            name='event',
        ),
    ]
