# Generated by Django 4.1 on 2023-01-02 21:05

import django.contrib.postgres.constraints
import django.contrib.postgres.fields.ranges
from django.db import migrations, models


class Migration(migrations.Migration):

    dependencies = [
        ("membership", "0001_initial"),
    ]

    operations = [
        migrations.CreateModel(
            name="SubscriptionPeriod",
            fields=[
                (
                    "id",
                    models.AutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                (
                    "modified",
                    models.DateTimeField(auto_now=True, verbose_name="modified"),
                ),
                (
                    "created",
                    models.DateTimeField(auto_now_add=True, verbose_name="created"),
                ),
                (
                    "period",
                    django.contrib.postgres.fields.ranges.DateRangeField(
                        verbose_name="period"
                    ),
                ),
            ],
        ),
        migrations.RemoveField(
            model_name="membership",
            name="period",
        ),
        migrations.AlterField(
            model_name="membership",
            name="created",
            field=models.DateTimeField(auto_now_add=True, verbose_name="created"),
        ),
        migrations.AlterField(
            model_name="membershiptype",
            name="created",
            field=models.DateTimeField(auto_now_add=True, verbose_name="created"),
        ),
        migrations.AddConstraint(
            model_name="subscriptionperiod",
            constraint=django.contrib.postgres.constraints.ExclusionConstraint(
                expressions=[("period", "&&")], name="exclude_overlapping_periods"
            ),
        ),
    ]
