From 2b1f4ab51abe4b45763b1e5937d5b7584305233f Mon Sep 17 00:00:00 2001 From: Jeremy Stretch Date: Fri, 3 Apr 2026 16:32:08 -0400 Subject: [PATCH] Add migration files for indexes --- .../0057_default_ordering_indexes.py | 35 +++++++++ .../0022_default_ordering_indexes.py | 21 +++++ .../0231_default_ordering_indexes.py | 78 +++++++++++++++++++ .../0137_default_ordering_indexes.py | 74 ++++++++++++++++++ .../0089_default_ordering_indexes.py | 47 +++++++++++ .../0024_default_ordering_indexes.py | 21 +++++ .../0016_default_ordering_indexes.py | 19 +++++ .../0055_default_ordering_indexes.py | 23 ++++++ .../0012_default_ordering_indexes.py | 17 ++++ .../0019_default_ordering_indexes.py | 20 +++++ 10 files changed, 355 insertions(+) create mode 100644 netbox/circuits/migrations/0057_default_ordering_indexes.py create mode 100644 netbox/core/migrations/0022_default_ordering_indexes.py create mode 100644 netbox/dcim/migrations/0231_default_ordering_indexes.py create mode 100644 netbox/extras/migrations/0137_default_ordering_indexes.py create mode 100644 netbox/ipam/migrations/0089_default_ordering_indexes.py create mode 100644 netbox/tenancy/migrations/0024_default_ordering_indexes.py create mode 100644 netbox/users/migrations/0016_default_ordering_indexes.py create mode 100644 netbox/virtualization/migrations/0055_default_ordering_indexes.py create mode 100644 netbox/vpn/migrations/0012_default_ordering_indexes.py create mode 100644 netbox/wireless/migrations/0019_default_ordering_indexes.py diff --git a/netbox/circuits/migrations/0057_default_ordering_indexes.py b/netbox/circuits/migrations/0057_default_ordering_indexes.py new file mode 100644 index 000000000..256983f22 --- /dev/null +++ b/netbox/circuits/migrations/0057_default_ordering_indexes.py @@ -0,0 +1,35 @@ +from django.db import migrations, models + + +class Migration(migrations.Migration): + dependencies = [ + ('circuits', '0056_gfk_indexes'), + ('contenttypes', '0002_remove_content_type_name'), + ('dcim', '0230_interface_rf_channel_frequency_precision'), + ('extras', '0136_customfield_validation_schema'), + ('tenancy', '0023_add_mptt_tree_indexes'), + ('users', '0015_owner'), + ] + + operations = [ + migrations.AddIndex( + model_name='circuit', + index=models.Index(fields=['provider', 'provider_account', 'cid'], name='circuits_ci_provide_a0c42c_idx'), + ), + migrations.AddIndex( + model_name='circuitgroupassignment', + index=models.Index( + fields=['group', 'member_type', 'member_id', 'priority', 'id'], name='circuits_ci_group_i_2f8327_idx' + ), + ), + migrations.AddIndex( + model_name='virtualcircuit', + index=models.Index( + fields=['provider_network', 'provider_account', 'cid'], name='circuits_vi_provide_989efa_idx' + ), + ), + migrations.AddIndex( + model_name='virtualcircuittermination', + index=models.Index(fields=['virtual_circuit', 'role', 'id'], name='circuits_vi_virtual_4b5c0c_idx'), + ), + ] diff --git a/netbox/core/migrations/0022_default_ordering_indexes.py b/netbox/core/migrations/0022_default_ordering_indexes.py new file mode 100644 index 000000000..3c62d0c19 --- /dev/null +++ b/netbox/core/migrations/0022_default_ordering_indexes.py @@ -0,0 +1,21 @@ +from django.conf import settings +from django.db import migrations, models + + +class Migration(migrations.Migration): + dependencies = [ + ('contenttypes', '0002_remove_content_type_name'), + ('core', '0021_job_queue_name'), + migrations.swappable_dependency(settings.AUTH_USER_MODEL), + ] + + operations = [ + migrations.AddIndex( + model_name='configrevision', + index=models.Index(fields=['-created'], name='core_config_created_ef9552_idx'), + ), + migrations.AddIndex( + model_name='job', + index=models.Index(fields=['-created'], name='core_job_created_efa7cb_idx'), + ), + ] diff --git a/netbox/dcim/migrations/0231_default_ordering_indexes.py b/netbox/dcim/migrations/0231_default_ordering_indexes.py new file mode 100644 index 000000000..71d0953a0 --- /dev/null +++ b/netbox/dcim/migrations/0231_default_ordering_indexes.py @@ -0,0 +1,78 @@ +from django.conf import settings +from django.db import migrations, models + + +class Migration(migrations.Migration): + dependencies = [ + ('contenttypes', '0002_remove_content_type_name'), + ('dcim', '0230_interface_rf_channel_frequency_precision'), + ('extras', '0136_customfield_validation_schema'), + ('ipam', '0088_rename_vlangroup_total_vlan_ids'), + ('tenancy', '0023_add_mptt_tree_indexes'), + ('users', '0015_owner'), + ('virtualization', '0054_virtualmachinetype'), + migrations.swappable_dependency(settings.AUTH_USER_MODEL), + ] + + operations = [ + migrations.AddIndex( + model_name='consoleporttemplate', + index=models.Index(fields=['device_type', 'module_type', 'name'], name='dcim_consol_device__101ed5_idx'), + ), + migrations.AddIndex( + model_name='consoleserverporttemplate', + index=models.Index(fields=['device_type', 'module_type', 'name'], name='dcim_consol_device__a901e6_idx'), + ), + migrations.AddIndex( + model_name='device', + index=models.Index(fields=['name', 'id'], name='dcim_device_name_c27913_idx'), + ), + migrations.AddIndex( + model_name='frontporttemplate', + index=models.Index(fields=['device_type', 'module_type', 'name'], name='dcim_frontp_device__ec2ffb_idx'), + ), + migrations.AddIndex( + model_name='interfacetemplate', + index=models.Index(fields=['device_type', 'module_type', 'name'], name='dcim_interf_device__601012_idx'), + ), + migrations.AddIndex( + model_name='macaddress', + index=models.Index(fields=['mac_address', 'id'], name='dcim_macadd_mac_add_f2662a_idx'), + ), + migrations.AddIndex( + model_name='modulebaytemplate', + index=models.Index(fields=['device_type', 'module_type', 'name'], name='dcim_module_device__9eabad_idx'), + ), + migrations.AddIndex( + model_name='moduletype', + index=models.Index(fields=['profile', 'manufacturer', 'model'], name='dcim_module_profile_868277_idx'), + ), + migrations.AddIndex( + model_name='poweroutlettemplate', + index=models.Index(fields=['device_type', 'module_type', 'name'], name='dcim_powero_device__b83a8f_idx'), + ), + migrations.AddIndex( + model_name='powerporttemplate', + index=models.Index(fields=['device_type', 'module_type', 'name'], name='dcim_powerp_device__6c25da_idx'), + ), + migrations.AddIndex( + model_name='rack', + index=models.Index(fields=['site', 'location', 'name', 'id'], name='dcim_rack_site_id_715040_idx'), + ), + migrations.AddIndex( + model_name='rackreservation', + index=models.Index(fields=['created', 'id'], name='dcim_rackre_created_84f02e_idx'), + ), + migrations.AddIndex( + model_name='rearporttemplate', + index=models.Index(fields=['device_type', 'module_type', 'name'], name='dcim_rearpo_device__27f194_idx'), + ), + migrations.AddIndex( + model_name='virtualchassis', + index=models.Index(fields=['name'], name='dcim_virtua_name_2dc5cd_idx'), + ), + migrations.AddIndex( + model_name='virtualdevicecontext', + index=models.Index(fields=['name'], name='dcim_virtua_name_079d4d_idx'), + ), + ] diff --git a/netbox/extras/migrations/0137_default_ordering_indexes.py b/netbox/extras/migrations/0137_default_ordering_indexes.py new file mode 100644 index 000000000..2407e7868 --- /dev/null +++ b/netbox/extras/migrations/0137_default_ordering_indexes.py @@ -0,0 +1,74 @@ +from django.conf import settings +from django.db import migrations, models + + +class Migration(migrations.Migration): + dependencies = [ + ('contenttypes', '0002_remove_content_type_name'), + ('core', '0022_default_ordering_indexes'), + ('dcim', '0231_default_ordering_indexes'), + ('extras', '0136_customfield_validation_schema'), + ('tenancy', '0023_add_mptt_tree_indexes'), + ('users', '0015_owner'), + ('virtualization', '0054_virtualmachinetype'), + migrations.swappable_dependency(settings.AUTH_USER_MODEL), + ] + + operations = [ + migrations.AddIndex( + model_name='bookmark', + index=models.Index(fields=['created', 'id'], name='extras_book_created_1cb4a5_idx'), + ), + migrations.AddIndex( + model_name='configcontext', + index=models.Index(fields=['weight', 'name'], name='extras_conf_weight_ef9a81_idx'), + ), + migrations.AddIndex( + model_name='configtemplate', + index=models.Index(fields=['name'], name='extras_conf_name_e276bf_idx'), + ), + migrations.AddIndex( + model_name='customfield', + index=models.Index(fields=['group_name', 'weight', 'name'], name='extras_cust_group_n_40cb93_idx'), + ), + migrations.AddIndex( + model_name='customlink', + index=models.Index(fields=['group_name', 'weight', 'name'], name='extras_cust_group_n_5a8be0_idx'), + ), + migrations.AddIndex( + model_name='exporttemplate', + index=models.Index(fields=['name'], name='extras_expo_name_55a9af_idx'), + ), + migrations.AddIndex( + model_name='imageattachment', + index=models.Index(fields=['name', 'id'], name='extras_imag_name_23cd9f_idx'), + ), + migrations.AddIndex( + model_name='journalentry', + index=models.Index(fields=['-created'], name='extras_jour_created_ec0fac_idx'), + ), + migrations.AddIndex( + model_name='notification', + index=models.Index(fields=['-created', 'id'], name='extras_noti_created_1d5146_idx'), + ), + migrations.AddIndex( + model_name='savedfilter', + index=models.Index(fields=['weight', 'name'], name='extras_save_weight_c070c4_idx'), + ), + migrations.AddIndex( + model_name='script', + index=models.Index(fields=['module', 'name'], name='extras_scri_module__8bd99c_idx'), + ), + migrations.AddIndex( + model_name='subscription', + index=models.Index(fields=['-created', 'user'], name='extras_subs_created_034618_idx'), + ), + migrations.AddIndex( + model_name='tableconfig', + index=models.Index(fields=['weight', 'name'], name='extras_tabl_weight_7c4bb6_idx'), + ), + migrations.AddIndex( + model_name='tag', + index=models.Index(fields=['weight', 'name'], name='extras_tag_weight_d99f50_idx'), + ), + ] diff --git a/netbox/ipam/migrations/0089_default_ordering_indexes.py b/netbox/ipam/migrations/0089_default_ordering_indexes.py new file mode 100644 index 000000000..9407fbce1 --- /dev/null +++ b/netbox/ipam/migrations/0089_default_ordering_indexes.py @@ -0,0 +1,47 @@ +from django.db import migrations, models + + +class Migration(migrations.Migration): + dependencies = [ + ('contenttypes', '0002_remove_content_type_name'), + ('dcim', '0231_default_ordering_indexes'), + ('extras', '0137_default_ordering_indexes'), + ('ipam', '0088_rename_vlangroup_total_vlan_ids'), + ('tenancy', '0023_add_mptt_tree_indexes'), + ('users', '0015_owner'), + ] + + operations = [ + migrations.AddIndex( + model_name='aggregate', + index=models.Index(fields=['prefix', 'id'], name='ipam_aggreg_prefix_89dd71_idx'), + ), + migrations.AddIndex( + model_name='fhrpgroup', + index=models.Index(fields=['protocol', 'group_id', 'id'], name='ipam_fhrpgr_protoco_0445ae_idx'), + ), + migrations.AddIndex( + model_name='fhrpgroupassignment', + index=models.Index(fields=['-priority', 'id'], name='ipam_fhrpgr_priorit_b76335_idx'), + ), + migrations.AddIndex( + model_name='ipaddress', + index=models.Index(fields=['address', 'id'], name='ipam_ipaddr_address_3ddeea_idx'), + ), + migrations.AddIndex( + model_name='role', + index=models.Index(fields=['weight', 'name'], name='ipam_role_weight_01396b_idx'), + ), + migrations.AddIndex( + model_name='service', + index=models.Index(fields=['protocol', 'ports', 'id'], name='ipam_servic_protoco_687d13_idx'), + ), + migrations.AddIndex( + model_name='vlan', + index=models.Index(fields=['site', 'group', 'vid', 'id'], name='ipam_vlan_site_id_985573_idx'), + ), + migrations.AddIndex( + model_name='vrf', + index=models.Index(fields=['name', 'rd', 'id'], name='ipam_vrf_name_ec911d_idx'), + ), + ] diff --git a/netbox/tenancy/migrations/0024_default_ordering_indexes.py b/netbox/tenancy/migrations/0024_default_ordering_indexes.py new file mode 100644 index 000000000..1d3a0dbb1 --- /dev/null +++ b/netbox/tenancy/migrations/0024_default_ordering_indexes.py @@ -0,0 +1,21 @@ +from django.db import migrations, models + + +class Migration(migrations.Migration): + dependencies = [ + ('contenttypes', '0002_remove_content_type_name'), + ('extras', '0137_default_ordering_indexes'), + ('tenancy', '0023_add_mptt_tree_indexes'), + ('users', '0015_owner'), + ] + + operations = [ + migrations.AddIndex( + model_name='contact', + index=models.Index(fields=['name'], name='tenancy_con_name_c26153_idx'), + ), + migrations.AddIndex( + model_name='contactassignment', + index=models.Index(fields=['contact', 'priority', 'role', 'id'], name='tenancy_con_contact_23011f_idx'), + ), + ] diff --git a/netbox/users/migrations/0016_default_ordering_indexes.py b/netbox/users/migrations/0016_default_ordering_indexes.py new file mode 100644 index 000000000..bf5be5357 --- /dev/null +++ b/netbox/users/migrations/0016_default_ordering_indexes.py @@ -0,0 +1,19 @@ +from django.db import migrations, models + + +class Migration(migrations.Migration): + dependencies = [ + ('contenttypes', '0002_remove_content_type_name'), + ('users', '0015_owner'), + ] + + operations = [ + migrations.AddIndex( + model_name='objectpermission', + index=models.Index(fields=['name'], name='users_objec_name_ca707b_idx'), + ), + migrations.AddIndex( + model_name='token', + index=models.Index(fields=['-created'], name='users_token_created_1467b4_idx'), + ), + ] diff --git a/netbox/virtualization/migrations/0055_default_ordering_indexes.py b/netbox/virtualization/migrations/0055_default_ordering_indexes.py new file mode 100644 index 000000000..f3e1d5236 --- /dev/null +++ b/netbox/virtualization/migrations/0055_default_ordering_indexes.py @@ -0,0 +1,23 @@ +from django.db import migrations, models + + +class Migration(migrations.Migration): + dependencies = [ + ('dcim', '0231_default_ordering_indexes'), + ('extras', '0137_default_ordering_indexes'), + ('ipam', '0089_default_ordering_indexes'), + ('tenancy', '0024_default_ordering_indexes'), + ('users', '0016_default_ordering_indexes'), + ('virtualization', '0054_virtualmachinetype'), + ] + + operations = [ + migrations.AddIndex( + model_name='virtualmachine', + index=models.Index(fields=['name', 'id'], name='virtualizat_name_16033e_idx'), + ), + migrations.AddIndex( + model_name='virtualmachinetype', + index=models.Index(fields=['name'], name='virtualizat_name_6cff11_idx'), + ), + ] diff --git a/netbox/vpn/migrations/0012_default_ordering_indexes.py b/netbox/vpn/migrations/0012_default_ordering_indexes.py new file mode 100644 index 000000000..88180faa7 --- /dev/null +++ b/netbox/vpn/migrations/0012_default_ordering_indexes.py @@ -0,0 +1,17 @@ +from django.db import migrations, models + + +class Migration(migrations.Migration): + dependencies = [ + ('contenttypes', '0002_remove_content_type_name'), + ('extras', '0137_default_ordering_indexes'), + ('ipam', '0089_default_ordering_indexes'), + ('vpn', '0011_add_comments_to_organizationalmodel'), + ] + + operations = [ + migrations.AddIndex( + model_name='tunneltermination', + index=models.Index(fields=['tunnel', 'role', 'id'], name='vpn_tunnelt_tunnel__f542d3_idx'), + ), + ] diff --git a/netbox/wireless/migrations/0019_default_ordering_indexes.py b/netbox/wireless/migrations/0019_default_ordering_indexes.py new file mode 100644 index 000000000..cddfa0a8d --- /dev/null +++ b/netbox/wireless/migrations/0019_default_ordering_indexes.py @@ -0,0 +1,20 @@ +from django.db import migrations, models + + +class Migration(migrations.Migration): + dependencies = [ + ('contenttypes', '0002_remove_content_type_name'), + ('dcim', '0231_default_ordering_indexes'), + ('extras', '0137_default_ordering_indexes'), + ('ipam', '0089_default_ordering_indexes'), + ('tenancy', '0024_default_ordering_indexes'), + ('users', '0016_default_ordering_indexes'), + ('wireless', '0018_add_mptt_tree_indexes'), + ] + + operations = [ + migrations.AddIndex( + model_name='wirelesslan', + index=models.Index(fields=['ssid', 'id'], name='wireless_wi_ssid_64a9ce_idx'), + ), + ]