I have an application which is using 2 database, 1 is default another is custom. So 2 of my model are using default database, else are using custom database. i do not want to migrate custom database model while running 'make migrations' command. please help it out.
Using --no-migrations (alias: --nomigrations ) will disable Django migrations and create the database by inspecting all models.
There is a solution: run migrations 2 and 3 backwards with ./manage.py migrate my_app 0001 , then delete migration files. If you can't migrate back (e.g. you messed up with your database manually) then you can fake migrate back with ./manage.py migrate my_app 0001 --fake and set up database as it should be manually.
You can selectively disable migration for one or more Django-Models by setting managed = False
in Django Model Meta options.
from django.db import models
class LegacyModel(models.Model):
class Meta:
managed = False
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With