Managing migrations while moving from default taggit tags to taggit custom tags

30 views Asked by At

I was working on adding Tags to Articles, Comments using django-taggit.

But now I need the Tags to be associated with Account - so every tag must be tied to an account_id and only Articles, Comments of that Account can access these tags.

To achieve this, I had to implement a CustomTag.

In between these two stages, there were few other migrations relavant to other models. Example

0021_add_tags_to_articles_and_comments.py
0022_some_other_model_migration.py
0023_some_other_model_migration.py
0024_use_custom_tag_with_custom_taggedobject.py

Taggit documentation mentions the below to remove the tables taggit created and using custom tags

enter image description here

But this is messing up with my initial migration that added taggit tables because 0021_add_tags_to_articles_and_comments.py has dependencies

    dependencies = [
        (
            "taggit",
            "0006_rename_taggeditem_content_type_object_id_taggit_tagg_content_8fc721_idx",
        ),
        ("blog_app", "0020_blog"),
    ]

I cant delete all the migrations and redo them because these changes are being used in current app.

Is there any way to achieve this?

Apologies if the question doesn't seem well explained.

0

There are 0 answers