# Generated by Django 3.2.13 on 2023-02-08 15:15

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


class Migration(migrations.Migration):
    dependencies = [
        ("database", "0100_airtableimportjob_user_ip_address"),
        ("baserow_premium", "0007_fix_missing_colors_ids"),
    ]

    operations = [
        migrations.CreateModel(
            name="CalendarView",
            fields=[
                (
                    "view_ptr",
                    models.OneToOneField(
                        auto_created=True,
                        on_delete=django.db.models.deletion.CASCADE,
                        parent_link=True,
                        primary_key=True,
                        serialize=False,
                        to="database.view",
                    ),
                ),
                (
                    "date_field",
                    models.ForeignKey(
                        blank=True,
                        help_text="One of the supported date fields that the calendar view will be based on.",
                        null=True,
                        on_delete=django.db.models.deletion.SET_NULL,
                        related_name="calendar_view_date_field",
                        to="database.field",
                    ),
                ),
            ],
            options={
                "db_table": "database_calendarview",
            },
            bases=("database.view",),
        ),
        migrations.AlterField(
            model_name="kanbanviewfieldoptions",
            name="order",
            field=models.SmallIntegerField(
                default=32767,
                help_text="The order that the field has in the view. Lower value is first.",
            ),
        ),
        migrations.CreateModel(
            name="CalendarViewFieldOptions",
            fields=[
                (
                    "id",
                    models.AutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                (
                    "hidden",
                    models.BooleanField(
                        default=True,
                        help_text="Whether or not the field should be hidden in the card.",
                    ),
                ),
                (
                    "order",
                    models.SmallIntegerField(
                        default=32767,
                        help_text="The order that the field has in the view. Lower value is first.",
                    ),
                ),
                (
                    "calendar_view",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        to="baserow_premium.calendarview",
                    ),
                ),
                (
                    "field",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE, to="database.field"
                    ),
                ),
            ],
            options={
                "db_table": "database_calendarviewfieldoptions",
                "ordering": ("order", "field_id"),
            },
        ),
        migrations.AddField(
            model_name="calendarview",
            name="field_options",
            field=models.ManyToManyField(
                through="baserow_premium.CalendarViewFieldOptions", to="database.Field"
            ),
        ),
    ]
