How to run a migration for a specific app in Django

Viewed 35

What I need

I added an new app in my project and a separate database for it. I have created the Models for that app and now I need to migrate this models in this separate database

app name - authors_app

database name - authors

My code

python3 manage.py makemigrations authors_app

It creates the 0001_initial.py file which contains only models from my authors_app. So this step is OK

python3 manage.py migrate authors_app 0001_initial --database=authors

And this command runs not only my migrations from authors_app, but also migrations from my other app

Problem

I need to migrate only migrations from authors_app. But the migrate command runs the migrations from all apps. I have 58 migrations in my other app. And this command runs them all into the new database ...

Question

How can I run migrate for only authors_app

Update

Inside my authors_app Models I use one model from another app

from tibrains_app.models import Language

class AuthorLanguage(models.Model):

    author = models.OneToOneField(Author, on_delete=models.CASCADE)

    native_list = models.ManyToManyField(Language, related_name='author_native_languages')
    all_list = models.ManyToManyField(Language, related_name='author_all_languages')
    writing_list = models.ManyToManyField(Language, related_name='author_writing_languages')

And inside my 0001_initial file I have a dependencies

dependencies = [
        ('tibrains_app', '0058_book_history_period'),
    ]

Could this cause the problem?

0 Answers
Related