diff --git a/netbox/extras/migrations/0116_move_objectchange.py b/netbox/extras/migrations/0116_move_objectchange.py index 5ac134004b8..b3833f7f89a 100644 --- a/netbox/extras/migrations/0116_move_objectchange.py +++ b/netbox/extras/migrations/0116_move_objectchange.py @@ -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(