diff --git a/netbox/extras/migrations/0017_tag_taggeditem.py b/netbox/extras/migrations/0017_tag_taggeditem.py index d76abf2f1..8dbf32a75 100644 --- a/netbox/extras/migrations/0017_tag_taggeditem.py +++ b/netbox/extras/migrations/0017_tag_taggeditem.py @@ -36,6 +36,10 @@ class Migration(migrations.Migration): 'abstract': False, }, ), + migrations.AlterIndexTogether( + name='taggeditem', + index_together={('content_type', 'object_id')}, + ), ] operations = [ diff --git a/netbox/extras/migrations/0018_rename_tag_tables.py b/netbox/extras/migrations/0018_rename_tag_tables.py index 521db2cb2..9cdb41d06 100644 --- a/netbox/extras/migrations/0018_rename_tag_tables.py +++ b/netbox/extras/migrations/0018_rename_tag_tables.py @@ -28,6 +28,13 @@ class AppTaggitAlterModelTable(migrations.AlterModelTable): class Migration(migrations.Migration): + """ + Rename the tables from taggit_* to extras_* + + Note that while we change the database state, we are not deleting the django + model state for the taggit models. Doing so would result in makemigrations + recreating them. + """ dependencies = [ ('taggit', '0001_initial'), diff --git a/netbox/extras/migrations/0020_add_color_comments_to_tag.py b/netbox/extras/migrations/0019_add_color_comments_to_tag.py similarity index 62% rename from netbox/extras/migrations/0020_add_color_comments_to_tag.py rename to netbox/extras/migrations/0019_add_color_comments_to_tag.py index 0eebd4fbc..5c4b5807c 100644 --- a/netbox/extras/migrations/0020_add_color_comments_to_tag.py +++ b/netbox/extras/migrations/0019_add_color_comments_to_tag.py @@ -7,7 +7,13 @@ import utilities.fields class Migration(migrations.Migration): dependencies = [ - ('extras', '0019_delete_taggit_models'), + ('extras', '0018_rename_tag_tables'), + ('circuits', '0015_custom_tag_models'), + ('dcim', '0070_custom_tag_models'), + ('ipam', '0025_custom_tag_models'), + ('secrets', '0006_custom_tag_models'), + ('tenancy', '0006_custom_tag_models'), + ('virtualization', '0009_custom_tag_models'), ] operations = [ diff --git a/netbox/extras/migrations/0019_delete_taggit_models.py b/netbox/extras/migrations/0019_delete_taggit_models.py deleted file mode 100644 index fadb658e7..000000000 --- a/netbox/extras/migrations/0019_delete_taggit_models.py +++ /dev/null @@ -1,52 +0,0 @@ -# Generated by Django 2.1.4 on 2019-02-20 07:05 - -from django.db import migrations - - -class AppTaggitDeleteModel(migrations.DeleteModel): - """ - A special subclass of DeleteModel which hardcodes the app_label to 'taggit' - - This is needed because the migration deals with models which belong to the taggit - app, however because taggit is a 3rd party app, we cannot create our own migrations - there. - """ - - def state_forwards(self, app_label, state): - super().state_forwards('taggit', state) - - def database_forwards(self, app_label, schema_editor, from_state, to_state): - super().database_forwards('taggit', schema_editor, from_state, to_state) - - def database_backwards(self, app_label, schema_editor, from_state, to_state): - super().database_backwards('taggit', schema_editor, from_state, to_state) - - -class Migration(migrations.Migration): - - dependencies = [ - ('extras', '0018_rename_tag_tables'), - ('circuits', '0015_custom_tag_models'), - ('dcim', '0070_custom_tag_models'), - ('ipam', '0025_custom_tag_models'), - ('secrets', '0006_custom_tag_models'), - ('tenancy', '0006_custom_tag_models'), - ('virtualization', '0009_custom_tag_models'), - ] - - state_operations = [ - AppTaggitDeleteModel( - name='Tag', - ), - AppTaggitDeleteModel( - name='TaggedItem', - ), - ] - - database_operations = [] - operations = [ - migrations.SeparateDatabaseAndState( - database_operations=None, - state_operations=state_operations - ) - ]