mirror of
https://github.com/netbox-community/netbox.git
synced 2026-01-15 16:22:18 -06:00
* Enable E501 rule * Configure ruff formatter * Reformat migration files to fix line length violations * Fix various E501 errors * Move table template code to template_code.py & ignore E501 errors * Reformat raw SQL
This commit is contained in:
@@ -74,7 +74,8 @@ class IPSecProposalSerializer(NetBoxModelSerializer):
|
||||
model = IPSecProposal
|
||||
fields = (
|
||||
'id', 'url', 'display_url', 'display', 'name', 'description', 'encryption_algorithm',
|
||||
'authentication_algorithm', 'sa_lifetime_seconds', 'sa_lifetime_data', 'comments', 'tags', 'custom_fields', 'created', 'last_updated',
|
||||
'authentication_algorithm', 'sa_lifetime_seconds', 'sa_lifetime_data', 'comments', 'tags', 'custom_fields',
|
||||
'created', 'last_updated',
|
||||
)
|
||||
brief_fields = ('id', 'url', 'display', 'name', 'description')
|
||||
|
||||
|
||||
@@ -5,7 +5,6 @@ import utilities.json
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
initial = True
|
||||
|
||||
dependencies = [
|
||||
@@ -23,7 +22,10 @@ class Migration(migrations.Migration):
|
||||
('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)),
|
||||
(
|
||||
'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, unique=True)),
|
||||
@@ -46,7 +48,10 @@ class Migration(migrations.Migration):
|
||||
('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)),
|
||||
(
|
||||
'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, unique=True)),
|
||||
@@ -70,7 +75,6 @@ class Migration(migrations.Migration):
|
||||
name='tags',
|
||||
field=taggit.managers.TaggableManager(through='extras.TaggedItem', to='extras.Tag'),
|
||||
),
|
||||
|
||||
# IPSec
|
||||
migrations.CreateModel(
|
||||
name='IPSecProposal',
|
||||
@@ -78,7 +82,10 @@ class Migration(migrations.Migration):
|
||||
('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)),
|
||||
(
|
||||
'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, unique=True)),
|
||||
@@ -100,7 +107,10 @@ class Migration(migrations.Migration):
|
||||
('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)),
|
||||
(
|
||||
'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, unique=True)),
|
||||
@@ -128,13 +138,26 @@ class Migration(migrations.Migration):
|
||||
('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)),
|
||||
(
|
||||
'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, unique=True)),
|
||||
('mode', models.CharField()),
|
||||
('ike_policy', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='ipsec_profiles', to='vpn.ikepolicy')),
|
||||
('ipsec_policy', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='ipsec_profiles', to='vpn.ipsecpolicy')),
|
||||
(
|
||||
'ike_policy',
|
||||
models.ForeignKey(
|
||||
on_delete=django.db.models.deletion.PROTECT, related_name='ipsec_profiles', to='vpn.ikepolicy'
|
||||
),
|
||||
),
|
||||
(
|
||||
'ipsec_policy',
|
||||
models.ForeignKey(
|
||||
on_delete=django.db.models.deletion.PROTECT, related_name='ipsec_profiles', to='vpn.ipsecpolicy'
|
||||
),
|
||||
),
|
||||
('tags', taggit.managers.TaggableManager(through='extras.TaggedItem', to='extras.Tag')),
|
||||
],
|
||||
options={
|
||||
@@ -143,7 +166,6 @@ class Migration(migrations.Migration):
|
||||
'ordering': ('name',),
|
||||
},
|
||||
),
|
||||
|
||||
# Tunnels
|
||||
migrations.CreateModel(
|
||||
name='TunnelGroup',
|
||||
@@ -151,7 +173,10 @@ class Migration(migrations.Migration):
|
||||
('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)),
|
||||
(
|
||||
'custom_field_data',
|
||||
models.JSONField(blank=True, default=dict, encoder=utilities.json.CustomFieldJSONEncoder),
|
||||
),
|
||||
('name', models.CharField(max_length=100, unique=True)),
|
||||
('slug', models.SlugField(max_length=100, unique=True)),
|
||||
('description', models.CharField(blank=True, max_length=200)),
|
||||
@@ -173,17 +198,47 @@ class Migration(migrations.Migration):
|
||||
('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)),
|
||||
(
|
||||
'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, unique=True)),
|
||||
('status', models.CharField(default='active', max_length=50)),
|
||||
('group', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, related_name='tunnels', to='vpn.tunnelgroup')),
|
||||
(
|
||||
'group',
|
||||
models.ForeignKey(
|
||||
blank=True,
|
||||
null=True,
|
||||
on_delete=django.db.models.deletion.PROTECT,
|
||||
related_name='tunnels',
|
||||
to='vpn.tunnelgroup',
|
||||
),
|
||||
),
|
||||
('encapsulation', models.CharField(max_length=50)),
|
||||
('tunnel_id', models.PositiveBigIntegerField(blank=True, null=True)),
|
||||
('ipsec_profile', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, related_name='tunnels', to='vpn.ipsecprofile')),
|
||||
(
|
||||
'ipsec_profile',
|
||||
models.ForeignKey(
|
||||
blank=True,
|
||||
null=True,
|
||||
on_delete=django.db.models.deletion.PROTECT,
|
||||
related_name='tunnels',
|
||||
to='vpn.ipsecprofile',
|
||||
),
|
||||
),
|
||||
('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='tunnels', to='tenancy.tenant')),
|
||||
(
|
||||
'tenant',
|
||||
models.ForeignKey(
|
||||
blank=True,
|
||||
null=True,
|
||||
on_delete=django.db.models.deletion.PROTECT,
|
||||
related_name='tunnels',
|
||||
to='tenancy.tenant',
|
||||
),
|
||||
),
|
||||
],
|
||||
options={
|
||||
'verbose_name': 'tunnel',
|
||||
@@ -197,7 +252,9 @@ class Migration(migrations.Migration):
|
||||
),
|
||||
migrations.AddConstraint(
|
||||
model_name='tunnel',
|
||||
constraint=models.UniqueConstraint(condition=models.Q(('group__isnull', True)), fields=('name',), name='vpn_tunnel_name'),
|
||||
constraint=models.UniqueConstraint(
|
||||
condition=models.Q(('group__isnull', True)), fields=('name',), name='vpn_tunnel_name'
|
||||
),
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name='TunnelTermination',
|
||||
@@ -205,13 +262,35 @@ class Migration(migrations.Migration):
|
||||
('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)),
|
||||
(
|
||||
'custom_field_data',
|
||||
models.JSONField(blank=True, default=dict, encoder=utilities.json.CustomFieldJSONEncoder),
|
||||
),
|
||||
('role', models.CharField(default='peer', max_length=50)),
|
||||
('termination_id', models.PositiveBigIntegerField(blank=True, null=True)),
|
||||
('termination_type', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='+', to='contenttypes.contenttype')),
|
||||
('outside_ip', models.OneToOneField(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, related_name='tunnel_termination', to='ipam.ipaddress')),
|
||||
(
|
||||
'termination_type',
|
||||
models.ForeignKey(
|
||||
on_delete=django.db.models.deletion.PROTECT, related_name='+', to='contenttypes.contenttype'
|
||||
),
|
||||
),
|
||||
(
|
||||
'outside_ip',
|
||||
models.OneToOneField(
|
||||
blank=True,
|
||||
null=True,
|
||||
on_delete=django.db.models.deletion.PROTECT,
|
||||
related_name='tunnel_termination',
|
||||
to='ipam.ipaddress',
|
||||
),
|
||||
),
|
||||
('tags', taggit.managers.TaggableManager(through='extras.TaggedItem', to='extras.Tag')),
|
||||
('tunnel', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='terminations', to='vpn.tunnel')),
|
||||
(
|
||||
'tunnel',
|
||||
models.ForeignKey(
|
||||
on_delete=django.db.models.deletion.CASCADE, related_name='terminations', to='vpn.tunnel'
|
||||
),
|
||||
),
|
||||
],
|
||||
options={
|
||||
'verbose_name': 'tunnel termination',
|
||||
@@ -225,6 +304,10 @@ class Migration(migrations.Migration):
|
||||
),
|
||||
migrations.AddConstraint(
|
||||
model_name='tunneltermination',
|
||||
constraint=models.UniqueConstraint(fields=('termination_type', 'termination_id'), name='vpn_tunneltermination_termination', violation_error_message='An object may be terminated to only one tunnel at a time.'),
|
||||
constraint=models.UniqueConstraint(
|
||||
fields=('termination_type', 'termination_id'),
|
||||
name='vpn_tunneltermination_termination',
|
||||
violation_error_message='An object may be terminated to only one tunnel at a time.',
|
||||
),
|
||||
),
|
||||
]
|
||||
|
||||
@@ -5,7 +5,6 @@ import utilities.json
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('extras', '0099_cachedvalue_ordering'),
|
||||
('contenttypes', '0002_remove_content_type_name'),
|
||||
@@ -23,17 +22,35 @@ class Migration(migrations.Migration):
|
||||
('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)),
|
||||
(
|
||||
'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, unique=True)),
|
||||
('slug', models.SlugField(max_length=100, unique=True)),
|
||||
('type', models.CharField(max_length=50)),
|
||||
('identifier', models.BigIntegerField(blank=True, null=True)),
|
||||
('export_targets', models.ManyToManyField(blank=True, related_name='exporting_l2vpns', to='ipam.routetarget')),
|
||||
('import_targets', models.ManyToManyField(blank=True, related_name='importing_l2vpns', to='ipam.routetarget')),
|
||||
(
|
||||
'export_targets',
|
||||
models.ManyToManyField(blank=True, related_name='exporting_l2vpns', to='ipam.routetarget'),
|
||||
),
|
||||
(
|
||||
'import_targets',
|
||||
models.ManyToManyField(blank=True, related_name='importing_l2vpns', to='ipam.routetarget'),
|
||||
),
|
||||
('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='l2vpns', to='tenancy.tenant')),
|
||||
(
|
||||
'tenant',
|
||||
models.ForeignKey(
|
||||
blank=True,
|
||||
null=True,
|
||||
on_delete=django.db.models.deletion.PROTECT,
|
||||
related_name='l2vpns',
|
||||
to='tenancy.tenant',
|
||||
),
|
||||
),
|
||||
],
|
||||
options={
|
||||
'verbose_name': 'L2VPN',
|
||||
@@ -47,10 +64,33 @@ class Migration(migrations.Migration):
|
||||
('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)),
|
||||
(
|
||||
'custom_field_data',
|
||||
models.JSONField(blank=True, default=dict, encoder=utilities.json.CustomFieldJSONEncoder),
|
||||
),
|
||||
('assigned_object_id', models.PositiveBigIntegerField()),
|
||||
('assigned_object_type', models.ForeignKey(limit_choices_to=models.Q(models.Q(models.Q(('app_label', 'dcim'), ('model', 'interface')), models.Q(('app_label', 'ipam'), ('model', 'vlan')), models.Q(('app_label', 'virtualization'), ('model', 'vminterface')), _connector='OR')), on_delete=django.db.models.deletion.PROTECT, related_name='+', to='contenttypes.contenttype')),
|
||||
('l2vpn', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='terminations', to='vpn.l2vpn')),
|
||||
(
|
||||
'assigned_object_type',
|
||||
models.ForeignKey(
|
||||
limit_choices_to=models.Q(
|
||||
models.Q(
|
||||
models.Q(('app_label', 'dcim'), ('model', 'interface')),
|
||||
models.Q(('app_label', 'ipam'), ('model', 'vlan')),
|
||||
models.Q(('app_label', 'virtualization'), ('model', 'vminterface')),
|
||||
_connector='OR',
|
||||
)
|
||||
),
|
||||
on_delete=django.db.models.deletion.PROTECT,
|
||||
related_name='+',
|
||||
to='contenttypes.contenttype',
|
||||
),
|
||||
),
|
||||
(
|
||||
'l2vpn',
|
||||
models.ForeignKey(
|
||||
on_delete=django.db.models.deletion.CASCADE, related_name='terminations', to='vpn.l2vpn'
|
||||
),
|
||||
),
|
||||
('tags', taggit.managers.TaggableManager(through='extras.TaggedItem', to='extras.Tag')),
|
||||
],
|
||||
options={
|
||||
@@ -66,12 +106,13 @@ class Migration(migrations.Migration):
|
||||
migrations.AddConstraint(
|
||||
model_name='l2vpntermination',
|
||||
constraint=models.UniqueConstraint(
|
||||
fields=('assigned_object_type', 'assigned_object_id'),
|
||||
name='vpn_l2vpntermination_assigned_object'
|
||||
fields=('assigned_object_type', 'assigned_object_id'), name='vpn_l2vpntermination_assigned_object'
|
||||
),
|
||||
),
|
||||
migrations.AddIndex(
|
||||
model_name='l2vpntermination',
|
||||
index=models.Index(fields=['assigned_object_type', 'assigned_object_id'], name='vpn_l2vpnte_assigne_9c55f8_idx'),
|
||||
index=models.Index(
|
||||
fields=['assigned_object_type', 'assigned_object_id'], name='vpn_l2vpnte_assigne_9c55f8_idx'
|
||||
),
|
||||
),
|
||||
]
|
||||
|
||||
@@ -5,7 +5,6 @@ import django.db.models.deletion
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('ipam', '0069_gfk_indexes'),
|
||||
('vpn', '0002_move_l2vpn'),
|
||||
@@ -15,6 +14,12 @@ class Migration(migrations.Migration):
|
||||
migrations.AlterField(
|
||||
model_name='tunneltermination',
|
||||
name='outside_ip',
|
||||
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, related_name='tunnel_terminations', to='ipam.ipaddress'),
|
||||
field=models.ForeignKey(
|
||||
blank=True,
|
||||
null=True,
|
||||
on_delete=django.db.models.deletion.PROTECT,
|
||||
related_name='tunnel_terminations',
|
||||
to='ipam.ipaddress',
|
||||
),
|
||||
),
|
||||
]
|
||||
|
||||
@@ -4,7 +4,6 @@ from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('vpn', '0003_ipaddress_multiple_tunnel_terminations'),
|
||||
]
|
||||
|
||||
@@ -2,43 +2,56 @@ from django.db import migrations
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('vpn', '0004_alter_ikepolicy_mode'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
|
||||
# Rename vpn_l2vpn constraints
|
||||
migrations.RunSQL("ALTER TABLE vpn_l2vpn RENAME CONSTRAINT ipam_l2vpn_tenant_id_bb2564a6_fk_tenancy_tenant_id TO vpn_l2vpn_tenant_id_57ec8f92_fk_tenancy_tenant_id"),
|
||||
|
||||
migrations.RunSQL((
|
||||
'ALTER TABLE vpn_l2vpn '
|
||||
'RENAME CONSTRAINT ipam_l2vpn_tenant_id_bb2564a6_fk_tenancy_tenant_id '
|
||||
'TO vpn_l2vpn_tenant_id_57ec8f92_fk_tenancy_tenant_id'
|
||||
)),
|
||||
# Rename ipam_l2vpn_* sequences
|
||||
migrations.RunSQL("ALTER TABLE ipam_l2vpn_export_targets_id_seq RENAME TO vpn_l2vpn_export_targets_id_seq"),
|
||||
migrations.RunSQL("ALTER TABLE ipam_l2vpn_id_seq RENAME TO vpn_l2vpn_id_seq"),
|
||||
migrations.RunSQL("ALTER TABLE ipam_l2vpn_import_targets_id_seq RENAME TO vpn_l2vpn_import_targets_id_seq"),
|
||||
|
||||
migrations.RunSQL('ALTER TABLE ipam_l2vpn_export_targets_id_seq RENAME TO vpn_l2vpn_export_targets_id_seq'),
|
||||
migrations.RunSQL('ALTER TABLE ipam_l2vpn_id_seq RENAME TO vpn_l2vpn_id_seq'),
|
||||
migrations.RunSQL('ALTER TABLE ipam_l2vpn_import_targets_id_seq RENAME TO vpn_l2vpn_import_targets_id_seq'),
|
||||
# Rename ipam_l2vpn_* indexes
|
||||
migrations.RunSQL("ALTER INDEX ipam_l2vpn_pkey RENAME TO vpn_l2vpn_pkey"),
|
||||
migrations.RunSQL("ALTER INDEX ipam_l2vpn_name_5e1c080f_like RENAME TO vpn_l2vpn_name_8824eda5_like"),
|
||||
migrations.RunSQL("ALTER INDEX ipam_l2vpn_name_key RENAME TO vpn_l2vpn_name_key"),
|
||||
migrations.RunSQL("ALTER INDEX ipam_l2vpn_slug_24008406_like RENAME TO vpn_l2vpn_slug_76b5a174_like"),
|
||||
migrations.RunSQL("ALTER INDEX ipam_l2vpn_tenant_id_bb2564a6 RENAME TO vpn_l2vpn_tenant_id_57ec8f92"),
|
||||
migrations.RunSQL('ALTER INDEX ipam_l2vpn_pkey RENAME TO vpn_l2vpn_pkey'),
|
||||
migrations.RunSQL('ALTER INDEX ipam_l2vpn_name_5e1c080f_like RENAME TO vpn_l2vpn_name_8824eda5_like'),
|
||||
migrations.RunSQL('ALTER INDEX ipam_l2vpn_name_key RENAME TO vpn_l2vpn_name_key'),
|
||||
migrations.RunSQL('ALTER INDEX ipam_l2vpn_slug_24008406_like RENAME TO vpn_l2vpn_slug_76b5a174_like'),
|
||||
migrations.RunSQL('ALTER INDEX ipam_l2vpn_tenant_id_bb2564a6 RENAME TO vpn_l2vpn_tenant_id_57ec8f92'),
|
||||
# The unique index for L2VPN.slug may have one of two names, depending on how it was created,
|
||||
# so we check for both.
|
||||
migrations.RunSQL("ALTER INDEX IF EXISTS ipam_l2vpn_slug_24008406_uniq RENAME TO vpn_l2vpn_slug_76b5a174_uniq"),
|
||||
migrations.RunSQL("ALTER INDEX IF EXISTS ipam_l2vpn_slug_key RENAME TO vpn_l2vpn_slug_key"),
|
||||
|
||||
migrations.RunSQL('ALTER INDEX IF EXISTS ipam_l2vpn_slug_24008406_uniq RENAME TO vpn_l2vpn_slug_76b5a174_uniq'),
|
||||
migrations.RunSQL('ALTER INDEX IF EXISTS ipam_l2vpn_slug_key RENAME TO vpn_l2vpn_slug_key'),
|
||||
# Rename vpn_l2vpntermination constraints
|
||||
migrations.RunSQL("ALTER TABLE vpn_l2vpntermination RENAME CONSTRAINT ipam_l2vpntermination_assigned_object_id_check TO vpn_l2vpntermination_assigned_object_id_check"),
|
||||
migrations.RunSQL("ALTER TABLE vpn_l2vpntermination RENAME CONSTRAINT ipam_l2vpnterminatio_assigned_object_type_3923c124_fk_django_co TO vpn_l2vpntermination_assigned_object_type_id_f063b865_fk_django_co"),
|
||||
migrations.RunSQL("ALTER TABLE vpn_l2vpntermination RENAME CONSTRAINT ipam_l2vpntermination_l2vpn_id_9e570aa1_fk_ipam_l2vpn_id TO vpn_l2vpntermination_l2vpn_id_f5367bbe_fk_vpn_l2vpn_id"),
|
||||
|
||||
migrations.RunSQL((
|
||||
'ALTER TABLE vpn_l2vpntermination '
|
||||
'RENAME CONSTRAINT ipam_l2vpntermination_assigned_object_id_check '
|
||||
'TO vpn_l2vpntermination_assigned_object_id_check'
|
||||
)),
|
||||
migrations.RunSQL((
|
||||
'ALTER TABLE vpn_l2vpntermination '
|
||||
'RENAME CONSTRAINT ipam_l2vpnterminatio_assigned_object_type_3923c124_fk_django_co '
|
||||
'TO vpn_l2vpntermination_assigned_object_type_id_f063b865_fk_django_co'
|
||||
)),
|
||||
migrations.RunSQL((
|
||||
'ALTER TABLE vpn_l2vpntermination '
|
||||
'RENAME CONSTRAINT ipam_l2vpntermination_l2vpn_id_9e570aa1_fk_ipam_l2vpn_id '
|
||||
'TO vpn_l2vpntermination_l2vpn_id_f5367bbe_fk_vpn_l2vpn_id'
|
||||
)),
|
||||
# Rename ipam_l2vpn_termination_* sequences
|
||||
migrations.RunSQL("ALTER TABLE ipam_l2vpntermination_id_seq RENAME TO vpn_l2vpntermination_id_seq"),
|
||||
|
||||
migrations.RunSQL('ALTER TABLE ipam_l2vpntermination_id_seq RENAME TO vpn_l2vpntermination_id_seq'),
|
||||
# Rename ipam_l2vpn_* indexes
|
||||
migrations.RunSQL("ALTER INDEX ipam_l2vpntermination_pkey RENAME TO vpn_l2vpntermination_pkey"),
|
||||
migrations.RunSQL("ALTER INDEX ipam_l2vpntermination_assigned_object_type_id_3923c124 RENAME TO vpn_l2vpntermination_assigned_object_type_id_f063b865"),
|
||||
migrations.RunSQL("ALTER INDEX ipam_l2vpntermination_l2vpn_id_9e570aa1 RENAME TO vpn_l2vpntermination_l2vpn_id_f5367bbe"),
|
||||
|
||||
migrations.RunSQL('ALTER INDEX ipam_l2vpntermination_pkey RENAME TO vpn_l2vpntermination_pkey'),
|
||||
migrations.RunSQL((
|
||||
'ALTER INDEX ipam_l2vpntermination_assigned_object_type_id_3923c124 '
|
||||
'RENAME TO vpn_l2vpntermination_assigned_object_type_id_f063b865'
|
||||
)),
|
||||
migrations.RunSQL(
|
||||
'ALTER INDEX ipam_l2vpntermination_l2vpn_id_9e570aa1 RENAME TO vpn_l2vpntermination_l2vpn_id_f5367bbe'
|
||||
),
|
||||
]
|
||||
|
||||
@@ -16,7 +16,6 @@ def set_null_values(apps, schema_editor):
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('vpn', '0005_rename_indexes'),
|
||||
]
|
||||
@@ -42,8 +41,5 @@ class Migration(migrations.Migration):
|
||||
name='encryption_algorithm',
|
||||
field=models.CharField(blank=True, null=True),
|
||||
),
|
||||
migrations.RunPython(
|
||||
code=set_null_values,
|
||||
reverse_code=migrations.RunPython.noop
|
||||
),
|
||||
migrations.RunPython(code=set_null_values, reverse_code=migrations.RunPython.noop),
|
||||
]
|
||||
|
||||
@@ -2,7 +2,6 @@ from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('vpn', '0006_charfield_null_choices'),
|
||||
('dcim', '0197_natural_sort_collation'),
|
||||
|
||||
Reference in New Issue
Block a user