# Generated by Django 5.2.5 on 2026-01-17 02:48

import django.db.models.deletion
import netbox.models.deletion
import taggit.managers
import utilities.json
from django.db import migrations, models


class Migration(migrations.Migration):

    dependencies = [
        ('netbox_routing', '0020_communities'),
    ]

    operations = [
        migrations.CreateModel(
            name='BGPSessionTemplate',
            fields=[
                (
                    'id',
                    models.BigAutoField(
                        auto_created=True, primary_key=True, serialize=False
                    ),
                ),
                ('created', models.DateTimeField(auto_now_add=True, null=True)),
                ('last_updated', models.DateTimeField(auto_now=True, null=True)),
                (
                    'custom_field_data',
                    models.JSONField(
                        blank=True,
                        default=dict,
                        encoder=utilities.json.CustomFieldJSONEncoder,
                    ),
                ),
                ('description', models.CharField(blank=True, max_length=200)),
                ('comments', models.TextField(blank=True)),
                ('name', models.CharField(max_length=100)),
                ('enabled', models.BooleanField(blank=True, null=True)),
                ('bfd', models.CharField(blank=True, max_length=50, null=True)),
                ('password', models.CharField(blank=True, max_length=255, null=True)),
                (
                    'remote_as',
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.PROTECT,
                        related_name='session_templates_remote_as',
                        to='ipam.asn',
                    ),
                ),
                (
                    'local_as',
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.PROTECT,
                        related_name='session_templates_local_as',
                        to='ipam.asn',
                    ),
                ),
                (
                    'owner',
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.PROTECT,
                        to='users.owner',
                    ),
                ),
                (
                    'parent',
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.PROTECT,
                        related_name='children',
                        to='netbox_routing.bgpsessiontemplate',
                    ),
                ),
                (
                    'tags',
                    taggit.managers.TaggableManager(
                        through='extras.TaggedItem', to='extras.Tag'
                    ),
                ),
                (
                    'tenant',
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.PROTECT,
                        related_name='bgp_peer_session_templates',
                        to='tenancy.tenant',
                    ),
                ),
            ],
            options={
                'verbose_name': 'BGP Session Template',
                'verbose_name_plural': 'BGP Session Templates',
                'ordering': ('name',),
            },
            bases=(netbox.models.deletion.DeleteMixin, models.Model),
        ),
        migrations.CreateModel(
            name='BGPPolicyTemplate',
            fields=[
                (
                    'id',
                    models.BigAutoField(
                        auto_created=True, primary_key=True, serialize=False
                    ),
                ),
                ('created', models.DateTimeField(auto_now_add=True, null=True)),
                ('last_updated', models.DateTimeField(auto_now=True, null=True)),
                (
                    'custom_field_data',
                    models.JSONField(
                        blank=True,
                        default=dict,
                        encoder=utilities.json.CustomFieldJSONEncoder,
                    ),
                ),
                ('description', models.CharField(blank=True, max_length=200)),
                ('comments', models.TextField(blank=True)),
                ('name', models.CharField(max_length=100)),
                ('enabled', models.BooleanField(blank=True, null=True)),
                (
                    'owner',
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.PROTECT,
                        to='users.owner',
                    ),
                ),
                (
                    'parents',
                    models.ManyToManyField(
                        related_name='children', to='netbox_routing.bgppolicytemplate'
                    ),
                ),
                (
                    'prefixlist_in',
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.PROTECT,
                        related_name='template_afs_in',
                        to='netbox_routing.prefixlist',
                    ),
                ),
                (
                    'prefixlist_out',
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.PROTECT,
                        related_name='template_afs_out',
                        to='netbox_routing.prefixlist',
                    ),
                ),
                (
                    'routemap_in',
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.PROTECT,
                        related_name='template_afs_in',
                        to='netbox_routing.routemap',
                    ),
                ),
                (
                    'routemap_out',
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.PROTECT,
                        related_name='template_afs_out',
                        to='netbox_routing.routemap',
                    ),
                ),
                (
                    'tags',
                    taggit.managers.TaggableManager(
                        through='extras.TaggedItem', to='extras.Tag'
                    ),
                ),
                (
                    'tenant',
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.PROTECT,
                        related_name='bgp_peer_policy_templates',
                        to='tenancy.tenant',
                    ),
                ),
            ],
            options={
                'verbose_name': 'BGP Policy Template',
                'verbose_name_plural': 'BGP Policy Templates',
                'ordering': ('name',),
            },
            bases=(netbox.models.deletion.DeleteMixin, models.Model),
        ),
        migrations.CreateModel(
            name='BGPPeerTemplate',
            fields=[
                (
                    'id',
                    models.BigAutoField(
                        auto_created=True, primary_key=True, serialize=False
                    ),
                ),
                ('created', models.DateTimeField(auto_now_add=True, null=True)),
                ('last_updated', models.DateTimeField(auto_now=True, null=True)),
                (
                    'custom_field_data',
                    models.JSONField(
                        blank=True,
                        default=dict,
                        encoder=utilities.json.CustomFieldJSONEncoder,
                    ),
                ),
                ('description', models.CharField(blank=True, max_length=200)),
                ('comments', models.TextField(blank=True)),
                ('name', models.CharField(max_length=100)),
                ('enabled', models.BooleanField(blank=True, null=True)),
                (
                    'owner',
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.PROTECT,
                        to='users.owner',
                    ),
                ),
                (
                    'remote_as',
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.PROTECT,
                        related_name='+',
                        to='ipam.asn',
                    ),
                ),
                (
                    'tags',
                    taggit.managers.TaggableManager(
                        through='extras.TaggedItem', to='extras.Tag'
                    ),
                ),
                (
                    'tenant',
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.PROTECT,
                        related_name='bgp_peer_templates',
                        to='tenancy.tenant',
                    ),
                ),
            ],
            options={
                'verbose_name': 'BGP Peer Template',
                'verbose_name_plural': 'BGP Peer Templates',
                'ordering': ('name',),
            },
            bases=(netbox.models.deletion.DeleteMixin, models.Model),
        ),
        migrations.CreateModel(
            name='BGPRouter',
            fields=[
                (
                    'id',
                    models.BigAutoField(
                        auto_created=True, primary_key=True, serialize=False
                    ),
                ),
                ('created', models.DateTimeField(auto_now_add=True, null=True)),
                ('last_updated', models.DateTimeField(auto_now=True, null=True)),
                (
                    'custom_field_data',
                    models.JSONField(
                        blank=True,
                        default=dict,
                        encoder=utilities.json.CustomFieldJSONEncoder,
                    ),
                ),
                ('description', models.CharField(blank=True, max_length=200)),
                ('comments', models.TextField(blank=True)),
                (
                    'asn',
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.PROTECT,
                        related_name='router',
                        to='ipam.asn',
                    ),
                ),
                (
                    'assigned_object_id',
                    models.PositiveBigIntegerField(blank=True, null=True),
                ),
                (
                    'assigned_object_type',
                    models.ForeignKey(
                        blank=True,
                        limit_choices_to=models.Q(
                            models.Q(
                                models.Q(('app_label', 'dcim'), ('model', 'region')),
                                models.Q(('app_label', 'dcim'), ('model', 'site')),
                                models.Q(
                                    ('app_label', 'dcim'), ('model', 'site_group')
                                ),
                                models.Q(('app_label', 'dcim'), ('model', 'location')),
                                models.Q(('app_label', 'dcim'), ('model', 'device')),
                                models.Q(
                                    ('app_label', 'virtualization'),
                                    ('model', 'cluster'),
                                ),
                                models.Q(
                                    ('app_label', 'virtualization'),
                                    ('model', 'virtual_machine'),
                                ),
                                _connector='OR',
                            )
                        ),
                        null=True,
                        on_delete=django.db.models.deletion.PROTECT,
                        related_name='+',
                        to='contenttypes.contenttype',
                    ),
                ),
                (
                    'name',
                    models.CharField(
                        max_length=100,
                    ),
                ),
                (
                    'peer_templates',
                    models.ManyToManyField(
                        related_name='routers', to='netbox_routing.bgppeertemplate'
                    ),
                ),
                (
                    'policy_templates',
                    models.ManyToManyField(
                        related_name='routers', to='netbox_routing.bgppolicytemplate'
                    ),
                ),
                (
                    'session_templates',
                    models.ManyToManyField(
                        related_name='routers', to='netbox_routing.bgpsessiontemplate'
                    ),
                ),
                (
                    'owner',
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.PROTECT,
                        to='users.owner',
                    ),
                ),
                (
                    'tags',
                    taggit.managers.TaggableManager(
                        through='extras.TaggedItem', to='extras.Tag'
                    ),
                ),
                (
                    'tenant',
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.PROTECT,
                        related_name='bgp_routers',
                        to='tenancy.tenant',
                    ),
                ),
            ],
            options={
                'verbose_name': 'BGP Router',
                'verbose_name_plural': 'BGP Routers',
                'ordering': (
                    'assigned_object_type',
                    'assigned_object_id',
                    'asn',
                    'name',
                ),
            },
            bases=(netbox.models.deletion.DeleteMixin, models.Model),
        ),
        migrations.CreateModel(
            name='BGPScope',
            fields=[
                (
                    'id',
                    models.BigAutoField(
                        auto_created=True, primary_key=True, serialize=False
                    ),
                ),
                ('created', models.DateTimeField(auto_now_add=True, null=True)),
                ('last_updated', models.DateTimeField(auto_now=True, null=True)),
                (
                    'custom_field_data',
                    models.JSONField(
                        blank=True,
                        default=dict,
                        encoder=utilities.json.CustomFieldJSONEncoder,
                    ),
                ),
                ('description', models.CharField(blank=True, max_length=200)),
                ('comments', models.TextField(blank=True)),
                (
                    'owner',
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.PROTECT,
                        to='users.owner',
                    ),
                ),
                (
                    'router',
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.PROTECT,
                        related_name='scopes',
                        to='netbox_routing.bgprouter',
                    ),
                ),
                (
                    'tags',
                    taggit.managers.TaggableManager(
                        through='extras.TaggedItem', to='extras.Tag'
                    ),
                ),
                (
                    'tenant',
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.PROTECT,
                        related_name='bgp_scopes',
                        to='tenancy.tenant',
                    ),
                ),
                (
                    'vrf',
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.PROTECT,
                        related_name='scopes',
                        to='ipam.vrf',
                    ),
                ),
            ],
            options={
                'verbose_name': 'BGP Scope',
                'verbose_name_plural': 'BGP Scopes',
                'ordering': ('router', 'vrf'),
            },
            bases=(netbox.models.deletion.DeleteMixin, models.Model),
        ),
        migrations.CreateModel(
            name='BGPAddressFamily',
            fields=[
                (
                    'id',
                    models.BigAutoField(
                        auto_created=True, primary_key=True, serialize=False
                    ),
                ),
                ('created', models.DateTimeField(auto_now_add=True, null=True)),
                ('last_updated', models.DateTimeField(auto_now=True, null=True)),
                (
                    'custom_field_data',
                    models.JSONField(
                        blank=True,
                        default=dict,
                        encoder=utilities.json.CustomFieldJSONEncoder,
                    ),
                ),
                ('description', models.CharField(blank=True, max_length=200)),
                ('comments', models.TextField(blank=True)),
                ('address_family', models.CharField(max_length=50)),
                (
                    'owner',
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.PROTECT,
                        to='users.owner',
                    ),
                ),
                (
                    'scope',
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.PROTECT,
                        related_name='address_families',
                        to='netbox_routing.bgpscope',
                    ),
                ),
                (
                    'tenant',
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.PROTECT,
                        related_name='bgp_address_families',
                        to='tenancy.tenant',
                    ),
                ),
                (
                    'tags',
                    taggit.managers.TaggableManager(
                        through='extras.TaggedItem', to='extras.Tag'
                    ),
                ),
            ],
            options={
                'verbose_name': 'BGP Address Family',
                'verbose_name_plural': 'BGP Address Families',
                'ordering': ('scope', 'address_family'),
            },
            bases=(netbox.models.deletion.DeleteMixin, models.Model),
        ),
        migrations.CreateModel(
            name='BGPPeerAddressFamily',
            fields=[
                (
                    'id',
                    models.BigAutoField(
                        auto_created=True, primary_key=True, serialize=False
                    ),
                ),
                ('created', models.DateTimeField(auto_now_add=True, null=True)),
                ('last_updated', models.DateTimeField(auto_now=True, null=True)),
                (
                    'custom_field_data',
                    models.JSONField(
                        blank=True,
                        default=dict,
                        encoder=utilities.json.CustomFieldJSONEncoder,
                    ),
                ),
                ('description', models.CharField(blank=True, max_length=200)),
                ('comments', models.TextField(blank=True)),
                (
                    'assigned_object_id',
                    models.PositiveBigIntegerField(blank=True, null=True),
                ),
                ('enabled', models.BooleanField(blank=True, null=True)),
                (
                    'address_family',
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.PROTECT,
                        related_name='peer_address_families',
                        to='netbox_routing.bgpaddressfamily',
                    ),
                ),
                (
                    'assigned_object_type',
                    models.ForeignKey(
                        blank=True,
                        limit_choices_to=models.Q(
                            models.Q(
                                models.Q(
                                    ('app_label', 'netbox_routing'),
                                    ('model', 'bgppeer'),
                                ),
                                models.Q(
                                    ('app_label', 'netbox_routing'),
                                    ('model', 'bgppeertemplate'),
                                ),
                                _connector='OR',
                            )
                        ),
                        null=True,
                        on_delete=django.db.models.deletion.PROTECT,
                        related_name='+',
                        to='contenttypes.contenttype',
                    ),
                ),
                (
                    'owner',
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.PROTECT,
                        to='users.owner',
                    ),
                ),
                (
                    'prefixlist_in',
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.PROTECT,
                        related_name='peer_address_families_in',
                        to='netbox_routing.prefixlist',
                    ),
                ),
                (
                    'prefixlist_out',
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.PROTECT,
                        related_name='peer_address_families_out',
                        to='netbox_routing.prefixlist',
                    ),
                ),
                (
                    'routemap_in',
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.PROTECT,
                        related_name='peer_address_families_in',
                        to='netbox_routing.routemap',
                    ),
                ),
                (
                    'routemap_out',
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.PROTECT,
                        related_name='peer_address_families_out',
                        to='netbox_routing.routemap',
                    ),
                ),
                (
                    'tags',
                    taggit.managers.TaggableManager(
                        through='extras.TaggedItem', to='extras.Tag'
                    ),
                ),
                (
                    'tenant',
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.PROTECT,
                        related_name='bgp_peer_address_families',
                        to='tenancy.tenant',
                    ),
                ),
                (
                    'peer_policy',
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.PROTECT,
                        related_name='peer_address_families',
                        to='netbox_routing.bgppolicytemplate',
                    ),
                ),
            ],
            options={
                'verbose_name': 'BGP Peer Address Family',
                'verbose_name_plural': 'BGP Peer Address Families',
                'ordering': (
                    'assigned_object_type',
                    'assigned_object_id',
                    'address_family',
                ),
            },
            bases=(netbox.models.deletion.DeleteMixin, models.Model),
        ),
        migrations.CreateModel(
            name='BGPPeer',
            fields=[
                (
                    'id',
                    models.BigAutoField(
                        auto_created=True, primary_key=True, serialize=False
                    ),
                ),
                ('created', models.DateTimeField(auto_now_add=True, null=True)),
                ('last_updated', models.DateTimeField(auto_now=True, null=True)),
                (
                    'custom_field_data',
                    models.JSONField(
                        blank=True,
                        default=dict,
                        encoder=utilities.json.CustomFieldJSONEncoder,
                    ),
                ),
                ('description', models.CharField(blank=True, max_length=200)),
                ('comments', models.TextField(blank=True)),
                ('enabled', models.BooleanField(blank=True, null=True)),
                ('bfd', models.BooleanField(blank=True, null=True)),
                ('password', models.CharField(blank=True, max_length=255, null=True)),
                (
                    'local_as',
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.PROTECT,
                        related_name='+',
                        to='ipam.asn',
                    ),
                ),
                (
                    'name',
                    models.CharField(
                        max_length=100,
                    ),
                ),
                (
                    'owner',
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.PROTECT,
                        to='users.owner',
                    ),
                ),
                (
                    'peer',
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.PROTECT,
                        related_name='remote_peers',
                        to='ipam.ipaddress',
                    ),
                ),
                (
                    'source',
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.PROTECT,
                        related_name='source_peers',
                        to='ipam.ipaddress',
                    ),
                ),
                (
                    'remote_as',
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.PROTECT,
                        related_name='+',
                        to='ipam.asn',
                    ),
                ),
                (
                    'scope',
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.PROTECT,
                        related_name='peers',
                        to='netbox_routing.bgpscope',
                    ),
                ),
                (
                    'tags',
                    taggit.managers.TaggableManager(
                        through='extras.TaggedItem', to='extras.Tag'
                    ),
                ),
                (
                    'tenant',
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.PROTECT,
                        related_name='bgp_peers',
                        to='tenancy.tenant',
                    ),
                ),
                (
                    'peer_group',
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.PROTECT,
                        related_name='peers',
                        to='netbox_routing.bgppeertemplate',
                    ),
                ),
                (
                    'peer_session',
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.PROTECT,
                        related_name='peers',
                        to='netbox_routing.bgpsessiontemplate',
                    ),
                ),
            ],
            options={
                'verbose_name': 'BGP Peer',
                'verbose_name_plural': 'BGP Peers',
                'ordering': ('scope', 'peer', 'name'),
            },
            bases=(netbox.models.deletion.DeleteMixin, models.Model),
        ),
        migrations.CreateModel(
            name='BGPSetting',
            fields=[
                (
                    'id',
                    models.BigAutoField(
                        auto_created=True, primary_key=True, serialize=False
                    ),
                ),
                ('created', models.DateTimeField(auto_now_add=True, null=True)),
                ('last_updated', models.DateTimeField(auto_now=True, null=True)),
                (
                    'custom_field_data',
                    models.JSONField(
                        blank=True,
                        default=dict,
                        encoder=utilities.json.CustomFieldJSONEncoder,
                    ),
                ),
                ('description', models.CharField(blank=True, max_length=200)),
                ('comments', models.TextField(blank=True)),
                (
                    'assigned_object_id',
                    models.PositiveBigIntegerField(blank=True, null=True),
                ),
                ('key', models.CharField()),
                ('value', models.CharField()),
                (
                    'assigned_object_type',
                    models.ForeignKey(
                        blank=True,
                        limit_choices_to=models.Q(
                            models.Q(
                                models.Q(
                                    ('app_label', 'netbox_routing'),
                                    ('model', 'bgprouter'),
                                ),
                                models.Q(
                                    ('app_label', 'netbox_routing'),
                                    ('model', 'bgpscope'),
                                ),
                                models.Q(
                                    ('app_label', 'netbox_routing'),
                                    ('model', 'bgpaddressfamily'),
                                ),
                                models.Q(
                                    ('app_label', 'netbox_routing'),
                                    ('model', 'bgppeer'),
                                ),
                                models.Q(
                                    ('app_label', 'netbox_routing'),
                                    ('model', 'bgppeeraddressfamily'),
                                ),
                                _connector='OR',
                            )
                        ),
                        null=True,
                        on_delete=django.db.models.deletion.PROTECT,
                        related_name='+',
                        to='contenttypes.contenttype',
                    ),
                ),
                (
                    'owner',
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.PROTECT,
                        to='users.owner',
                    ),
                ),
                (
                    'tags',
                    taggit.managers.TaggableManager(
                        through='extras.TaggedItem', to='extras.Tag'
                    ),
                ),
            ],
            options={
                'verbose_name': 'BGP Setting',
                'verbose_name_plural': 'BGP Settings',
                'ordering': ('assigned_object_type', 'assigned_object_id', 'key'),
            },
            bases=(netbox.models.deletion.DeleteMixin, models.Model),
        ),
        migrations.AddConstraint(
            model_name='bgppeertemplate',
            constraint=models.UniqueConstraint(
                fields=('name', 'remote_as'),
                name='netbox_routing_bgppeertemplate_name_remote_as',
            ),
        ),
        migrations.AddConstraint(
            model_name='bgppolicytemplate',
            constraint=models.UniqueConstraint(
                fields=('name',), name='netbox_routing_bgppolicytemplate_name'
            ),
        ),
        migrations.AddConstraint(
            model_name='bgppeeraddressfamily',
            constraint=models.UniqueConstraint(
                fields=('assigned_object_type', 'assigned_object_id', 'address_family'),
                name='netbox_routing_bgppeeraddressfamily_assigned_object_address_family',
            ),
        ),
        migrations.AddConstraint(
            model_name='bgpscope',
            constraint=models.UniqueConstraint(
                fields=('router', 'vrf'),
                name='netbox_routing_bgpscope_router_vrf',
                nulls_distinct=False,
            ),
        ),
        migrations.AddConstraint(
            model_name='bgpaddressfamily',
            constraint=models.UniqueConstraint(
                fields=('scope', 'address_family'),
                name='netbox_routing_bgpaddressfamily_scope_address_family',
            ),
        ),
        migrations.AddConstraint(
            model_name='bgpsessiontemplate',
            constraint=models.UniqueConstraint(
                fields=('name',), name='netbox_routing_bgpsessiontemplate_name'
            ),
        ),
        migrations.AddConstraint(
            model_name='bgprouter',
            constraint=models.UniqueConstraint(
                fields=('assigned_object_type', 'assigned_object_id', 'asn'),
                name='netbox_routing_bgprouter_assigned_object_asn',
                nulls_distinct=False,
            ),
        ),
        migrations.AddConstraint(
            model_name='bgprouter',
            constraint=models.UniqueConstraint(
                fields=('assigned_object_type', 'assigned_object_id', 'name'),
                name='netbox_routing_bgprouter_assigned_object_name',
                nulls_distinct=False,
            ),
        ),
        migrations.AddConstraint(
            model_name='bgppeer',
            constraint=models.UniqueConstraint(
                fields=('scope', 'peer', 'name'),
                name='netbox_routing_bgppeer_scope_peer_name',
                nulls_distinct=False,
            ),
        ),
        migrations.AddConstraint(
            model_name='bgpsetting',
            constraint=models.UniqueConstraint(
                fields=('assigned_object_type', 'assigned_object_id', 'key'),
                name='netbox_routing_bgpsettings_unique',
            ),
        ),
        migrations.AddConstraint(
            model_name='bgprouter',
            constraint=models.CheckConstraint(
                condition=models.Q(
                    ('asn__isnull', False), ('name__isnull', False), _connector='OR'
                ),
                name='netbox_routing_bgprouter_identifier',
            ),
        ),
    ]
