mirror of
https://github.com/netbox-community/netbox.git
synced 2025-08-17 04:58:16 -06:00
Rename sequences & indexes after renaming users table
This commit is contained in:
parent
d042e6f69d
commit
bc2b1e0709
@ -1,5 +1,3 @@
|
|||||||
# Generated by Django 5.0.1 on 2024-01-31 23:18
|
|
||||||
|
|
||||||
from django.db import migrations
|
from django.db import migrations
|
||||||
|
|
||||||
|
|
||||||
@ -27,12 +25,26 @@ class Migration(migrations.Migration):
|
|||||||
]
|
]
|
||||||
|
|
||||||
operations = [
|
operations = [
|
||||||
# 0001_squashed had model with db_table=auth_user - now we switch it
|
# The User table was originally created as 'auth_user'. Now we nullify the model's
|
||||||
# to None to use the default Django resolution (users.user)
|
# db_table option, so that it defaults to the app & model name (users_user). This
|
||||||
|
# causes the database table to be renamed.
|
||||||
migrations.AlterModelTable(
|
migrations.AlterModelTable(
|
||||||
name='user',
|
name='user',
|
||||||
table=None,
|
table=None,
|
||||||
),
|
),
|
||||||
|
|
||||||
|
# Rename auth_user_* sequences
|
||||||
|
migrations.RunSQL("ALTER TABLE auth_user_groups_id_seq RENAME TO users_user_groups_id_seq"),
|
||||||
|
migrations.RunSQL("ALTER TABLE auth_user_id_seq RENAME TO users_user_id_seq"),
|
||||||
|
migrations.RunSQL("ALTER TABLE auth_user_user_permissions_id_seq RENAME TO users_user_user_permissions_id_seq"),
|
||||||
|
|
||||||
|
# Rename auth_user_* indexes
|
||||||
|
migrations.RunSQL("ALTER INDEX auth_user_pkey RENAME TO users_user_pkey"),
|
||||||
|
# Hash is deterministic; generated via schema_editor._create_index_name()
|
||||||
|
migrations.RunSQL("ALTER INDEX auth_user_username_6821ab7c_like RENAME TO users_user_username_06e46fe6_like"),
|
||||||
|
migrations.RunSQL("ALTER INDEX auth_user_username_key RENAME TO users_user_username_key"),
|
||||||
|
|
||||||
|
# Update ContentTypes
|
||||||
migrations.RunPython(
|
migrations.RunPython(
|
||||||
code=update_content_types,
|
code=update_content_types,
|
||||||
reverse_code=migrations.RunPython.noop
|
reverse_code=migrations.RunPython.noop
|
||||||
|
Loading…
Reference in New Issue
Block a user