Skip to content

Commit

Permalink
#16388: Rename database indexes & constraints
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremystretch committed Jun 17, 2024
1 parent 91dcecb commit 388ba3d
Showing 1 changed file with 67 additions and 0 deletions.
67 changes: 67 additions & 0 deletions netbox/extras/migrations/0116_move_objectchange.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,73 @@ class Migration(migrations.Migration):
name='ObjectChange',
table='core_objectchange',
),

# Rename PK sequence
migrations.RunSQL(
"ALTER TABLE extras_objectchange_id_seq"
" RENAME TO core_objectchange_id_seq"
),

# Rename indexes. Hashes generated by schema_editor._create_index_name()
migrations.RunSQL(
"ALTER INDEX extras_objectchange_pkey"
" RENAME TO core_objectchange_pkey"
),
migrations.RunSQL(
"ALTER INDEX extras_obje_changed_927fe5_idx"
" RENAME TO core_objectchange_changed_object_type_id_cha_79a9ed1e"
),
migrations.RunSQL(
"ALTER INDEX extras_obje_related_bfcdef_idx"
" RENAME TO core_objectchange_related_object_type_id_rel_a71d604a"
),
migrations.RunSQL(
"ALTER INDEX extras_objectchange_changed_object_type_id_b755bb60"
" RENAME TO core_objectchange_changed_object_type_id_2070ade6"
),
migrations.RunSQL(
"ALTER INDEX extras_objectchange_related_object_type_id_fe6e521f"
" RENAME TO core_objectchange_related_object_type_id_b80958af"
),
migrations.RunSQL(
"ALTER INDEX extras_objectchange_request_id_4ae21e90"
" RENAME TO core_objectchange_request_id_d9d160ac"
),
migrations.RunSQL(
"ALTER INDEX extras_objectchange_time_224380ea"
" RENAME TO core_objectchange_time_800f60a5"
),
migrations.RunSQL(
"ALTER INDEX extras_objectchange_user_id_7fdf8186"
" RENAME TO core_objectchange_user_id_2b2142be"
),

# Rename constraints
migrations.RunSQL(
"ALTER TABLE core_objectchange RENAME CONSTRAINT "
"extras_objectchange_changed_object_id_check TO "
"core_objectchange_changed_object_id_check"
),
migrations.RunSQL(
"ALTER TABLE core_objectchange RENAME CONSTRAINT "
"extras_objectchange_related_object_id_check TO "
"core_objectchange_related_object_id_check"
),
migrations.RunSQL(
"ALTER TABLE core_objectchange RENAME CONSTRAINT "
"extras_objectchange_changed_object_type__b755bb60_fk_django_co TO "
"core_objectchange_changed_object_type_id_2070ade6"
),
migrations.RunSQL(
"ALTER TABLE core_objectchange RENAME CONSTRAINT "
"extras_objectchange_related_object_type__fe6e521f_fk_django_co TO "
"core_objectchange_related_object_type_id_b80958af"
),
migrations.RunSQL(
"ALTER TABLE core_objectchange RENAME CONSTRAINT "
"extras_objectchange_user_id_7fdf8186_fk_auth_user_id TO "
"core_objectchange_user_id_2b2142be"
),
],
),
migrations.RunPython(
Expand Down

0 comments on commit 388ba3d

Please sign in to comment.