mirror of
https://github.com/netbox-community/netbox.git
synced 2026-01-07 04:27:27 -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
58 lines
3.1 KiB
Python
58 lines
3.1 KiB
Python
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'
|
|
)),
|
|
# 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'),
|
|
# 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'),
|
|
# 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'),
|
|
# 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'
|
|
)),
|
|
# Rename ipam_l2vpn_termination_* sequences
|
|
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'
|
|
),
|
|
]
|