Просмотр исходного кода

removed migration to delete taggit models

John Anderson 7 лет назад
Родитель
Сommit
fba6d28603

+ 4 - 0
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 = [

+ 7 - 0
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'),

+ 7 - 1
netbox/extras/migrations/0020_add_color_comments_to_tag.py → 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 = [

+ 0 - 52
netbox/extras/migrations/0019_delete_taggit_models.py

@@ -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
-        )
-    ]