# Generated by Django 4.1.7 on 2023-05-18 13:45

from django.db import migrations, models
import django.db.models.functions.text


class Migration(migrations.Migration):

    dependencies = [
        ('netbox_routing', '0002_netboxmodel_updates'),
    ]

    operations = [
        migrations.AlterModelOptions(
            name='prefixlist',
            options={'ordering': ['name']},
        ),
        migrations.AlterModelOptions(
            name='prefixlistentry',
            options={'ordering': ['prefix_list', 'sequence']},
        ),
        migrations.AlterModelOptions(
            name='routemap',
            options={'ordering': ['name']},
        ),
        migrations.AlterModelOptions(
            name='routemapentry',
            options={'ordering': ['route_map', 'sequence']},
        ),
        migrations.AlterModelOptions(
            name='staticroute',
            options={'ordering': ['vrf', 'prefix', 'metric']},
        ),
        migrations.AddConstraint(
            model_name='prefixlist',
            constraint=models.UniqueConstraint(
                django.db.models.functions.text.Lower('name'),
                name='netbox_routing_prefixlist_unique_name',
                violation_error_message='Name must be unique.',
            ),
        ),
        migrations.AddConstraint(
            model_name='prefixlistentry',
            constraint=models.UniqueConstraint(
                models.F('prefix_list'),
                models.F('sequence'),
                name='netbox_routing_prefixlistentry_unique_prefixlist_sequence',
                violation_error_message='Prefix List sequence must be unique.',
            ),
        ),
        migrations.AddConstraint(
            model_name='routemap',
            constraint=models.UniqueConstraint(
                django.db.models.functions.text.Lower('name'),
                name='netbox_routing_routemap_unique_name',
                violation_error_message='Name must be unique.',
            ),
        ),
        migrations.AddConstraint(
            model_name='routemapentry',
            constraint=models.UniqueConstraint(
                models.F('route_map'),
                models.F('sequence'),
                name='netbox_routing_routemapentry_unique_routemap_sequence',
                violation_error_message='Route Map sequence must be unique.',
            ),
        ),
        migrations.AddConstraint(
            model_name='staticroute',
            constraint=models.UniqueConstraint(
                models.F('vrf'),
                models.F('prefix'),
                models.F('next_hop'),
                name='netbox_routing_staticroute_unique_vrf_prefix_nexthop',
                violation_error_message='VRF, Prefix and Next Hop must be unique.',
            ),
        ),
    ]
