mirror of
https://github.com/netbox-community/netbox.git
synced 2026-01-17 01:02:18 -06:00
Reorder migrations
This commit is contained in:
@@ -145,8 +145,8 @@ class IPRangeSerializer(PrimaryModelSerializer):
|
|||||||
model = IPRange
|
model = IPRange
|
||||||
fields = [
|
fields = [
|
||||||
'id', 'url', 'display_url', 'display', 'family', 'prefix', 'start_address', 'end_address', 'size', 'vrf',
|
'id', 'url', 'display_url', 'display', 'family', 'prefix', 'start_address', 'end_address', 'size', 'vrf',
|
||||||
'tenant', 'status', 'role', 'description', 'owner', 'comments', 'tags', 'custom_fields', 'created', 'last_updated',
|
'tenant', 'status', 'role', 'description', 'owner', 'comments', 'tags', 'custom_fields', 'created',
|
||||||
'mark_populated', 'mark_utilized',
|
'last_updated', 'mark_populated', 'mark_utilized',
|
||||||
]
|
]
|
||||||
brief_fields = ('id', 'url', 'display', 'family', 'prefix', 'start_address', 'end_address', 'description')
|
brief_fields = ('id', 'url', 'display', 'family', 'prefix', 'start_address', 'end_address', 'description')
|
||||||
|
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ from django.db import migrations, models
|
|||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
dependencies = [
|
dependencies = [
|
||||||
('ipam', '0082_add_prefix_network_containment_indexes'),
|
('ipam', '0086_gfk_indexes'),
|
||||||
]
|
]
|
||||||
|
|
||||||
operations = [
|
operations = [
|
||||||
@@ -95,10 +95,8 @@ def set_prefix_parent(apps, schema_editor):
|
|||||||
for address in addresses:
|
for address in addresses:
|
||||||
i += 1
|
i += 1
|
||||||
prefixes = Prefix.objects.exclude(pk=address.pk).filter(
|
prefixes = Prefix.objects.exclude(pk=address.pk).filter(
|
||||||
models.Q(
|
models.Q(vrf=address.vrf, prefix__net_contains=str(address.prefix.ip))
|
||||||
vrf=address.vrf,
|
| models.Q(
|
||||||
prefix__net_contains=str(address.prefix.ip)
|
|
||||||
) | models.Q(
|
|
||||||
vrf=None,
|
vrf=None,
|
||||||
status=PrefixStatusChoices.STATUS_CONTAINER,
|
status=PrefixStatusChoices.STATUS_CONTAINER,
|
||||||
prefix__net_contains=str(address.prefix.ip),
|
prefix__net_contains=str(address.prefix.ip),
|
||||||
@@ -123,7 +121,7 @@ def unset_prefix_parent(apps, schema_editor):
|
|||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
dependencies = [
|
dependencies = [
|
||||||
('ipam', '0083_ipaddress_iprange_prefix_parent'),
|
('ipam', '0087_ipaddress_iprange_prefix_parent'),
|
||||||
]
|
]
|
||||||
|
|
||||||
operations = [
|
operations = [
|
||||||
@@ -7,7 +7,7 @@ from django.db import migrations, models
|
|||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
dependencies = [
|
dependencies = [
|
||||||
('ipam', '0084_prefix_ipam_prefix_delete_prefix_ipam_prefix_insert'),
|
('ipam', '0089_prefix_ipam_prefix_delete_prefix_ipam_prefix_insert'),
|
||||||
]
|
]
|
||||||
|
|
||||||
operations = [
|
operations = [
|
||||||
@@ -8,7 +8,7 @@ from django.db import migrations
|
|||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
dependencies = [
|
dependencies = [
|
||||||
('ipam', '0083_ipaddress_iprange_prefix_parent_data'),
|
('ipam', '0088_ipaddress_iprange_prefix_parent_data'),
|
||||||
]
|
]
|
||||||
|
|
||||||
operations = [
|
operations = [
|
||||||
@@ -17,7 +17,7 @@ class Migration(migrations.Migration):
|
|||||||
trigger=pgtrigger.compiler.Trigger(
|
trigger=pgtrigger.compiler.Trigger(
|
||||||
name='ipam_prefix_delete',
|
name='ipam_prefix_delete',
|
||||||
sql=pgtrigger.compiler.UpsertTriggerSql(
|
sql=pgtrigger.compiler.UpsertTriggerSql(
|
||||||
func="\n-- Update Child Prefix's with Prefix's PARENT\nUPDATE ipam_prefix SET parent_id=OLD.parent_id WHERE parent_id=OLD.id;\nRETURN OLD;\n", # noqa: E501
|
func="\n-- Update Child Prefix's with Prefix's PARENT\nUPDATE ipam_prefix SET parent_id=OLD.parent_id WHERE parent_id=OLD.id;\nRETURN OLD;\n", # noqa: E501
|
||||||
hash='899e1943cb201118be7ef02f36f49747224774f2',
|
hash='899e1943cb201118be7ef02f36f49747224774f2',
|
||||||
operation='DELETE',
|
operation='DELETE',
|
||||||
pgid='pgtrigger_ipam_prefix_delete_e7810',
|
pgid='pgtrigger_ipam_prefix_delete_e7810',
|
||||||
@@ -31,7 +31,7 @@ class Migration(migrations.Migration):
|
|||||||
trigger=pgtrigger.compiler.Trigger(
|
trigger=pgtrigger.compiler.Trigger(
|
||||||
name='ipam_prefix_insert',
|
name='ipam_prefix_insert',
|
||||||
sql=pgtrigger.compiler.UpsertTriggerSql(
|
sql=pgtrigger.compiler.UpsertTriggerSql(
|
||||||
func="\nUPDATE ipam_prefix\nSET parent_id=NEW.id \nWHERE \n prefix << NEW.prefix\n AND\n (\n (vrf_id = NEW.vrf_id OR (vrf_id IS NULL AND NEW.vrf_id IS NULL))\n OR\n (\n NEW.vrf_id IS NULL\n AND\n NEW.status = 'container'\n AND\n NOT EXISTS(\n SELECT 1 FROM ipam_prefix p WHERE p.prefix >> ipam_prefix.prefix AND p.vrf_id = ipam_prefix.vrf_id\n )\n )\n )\n AND id != NEW.id\n AND NOT EXISTS (\n SELECT 1 FROM ipam_prefix p\n WHERE\n p.prefix >> ipam_prefix.prefix\n AND p.prefix << NEW.prefix\n AND (\n (p.vrf_id = ipam_prefix.vrf_id OR (p.vrf_id IS NULL AND ipam_prefix.vrf_id IS NULL))\n OR\n (p.vrf_id IS NULL AND p.status = 'container')\n )\n AND p.id != NEW.id\n )\n;\nRETURN NEW;\n", # noqa: E501
|
func="\nUPDATE ipam_prefix\nSET parent_id=NEW.id \nWHERE \n prefix << NEW.prefix\n AND\n (\n (vrf_id = NEW.vrf_id OR (vrf_id IS NULL AND NEW.vrf_id IS NULL))\n OR\n (\n NEW.vrf_id IS NULL\n AND\n NEW.status = 'container'\n AND\n NOT EXISTS(\n SELECT 1 FROM ipam_prefix p WHERE p.prefix >> ipam_prefix.prefix AND p.vrf_id = ipam_prefix.vrf_id\n )\n )\n )\n AND id != NEW.id\n AND NOT EXISTS (\n SELECT 1 FROM ipam_prefix p\n WHERE\n p.prefix >> ipam_prefix.prefix\n AND p.prefix << NEW.prefix\n AND (\n (p.vrf_id = ipam_prefix.vrf_id OR (p.vrf_id IS NULL AND ipam_prefix.vrf_id IS NULL))\n OR\n (p.vrf_id IS NULL AND p.status = 'container')\n )\n AND p.id != NEW.id\n )\n;\nRETURN NEW;\n", # noqa: E501
|
||||||
hash='0e05bbe61861227a9eb710b6c94bae9e0cc7119e',
|
hash='0e05bbe61861227a9eb710b6c94bae9e0cc7119e',
|
||||||
operation='INSERT',
|
operation='INSERT',
|
||||||
pgid='pgtrigger_ipam_prefix_insert_46c72',
|
pgid='pgtrigger_ipam_prefix_insert_46c72',
|
||||||
@@ -8,7 +8,7 @@ from django.db import migrations
|
|||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
dependencies = [
|
dependencies = [
|
||||||
('ipam', '0085_alter_prefix_parent'),
|
('ipam', '0089_alter_prefix_parent'),
|
||||||
]
|
]
|
||||||
|
|
||||||
operations = [
|
operations = [
|
||||||
@@ -369,7 +369,7 @@ class IPAddressTable(TenancyColumnsMixin, ContactsColumnMixin, PrimaryModelTable
|
|||||||
model = IPAddress
|
model = IPAddress
|
||||||
fields = (
|
fields = (
|
||||||
'pk', 'id', 'address', 'vrf', 'prefix', 'status', 'role', 'tenant', 'tenant_group', 'nat_inside',
|
'pk', 'id', 'address', 'vrf', 'prefix', 'status', 'role', 'tenant', 'tenant_group', 'nat_inside',
|
||||||
'nat_outside', 'assigned', 'dns_name', 'description', 'comments', 'contacts','tags', 'created',
|
'nat_outside', 'assigned', 'dns_name', 'description', 'comments', 'contacts', 'tags', 'created',
|
||||||
'last_updated',
|
'last_updated',
|
||||||
)
|
)
|
||||||
default_columns = (
|
default_columns = (
|
||||||
|
|||||||
Reference in New Issue
Block a user