DEV Community

Discussion on: Django: Migrate --fake-initial gotchas

Collapse
 
k4ml profile image
Kamal Mustafa

By "models" here do you mean "table" and not the model class definition?

Collapse
 
simo97 profile image
ADONIS SIMO

Yes, let's take an example of my situation,

  • migrations from 0001 to 0004 contains my models and changes that are already applied in the db

  • when creating migration 0005 (with makemigrations) it happen to contain CreateModel() of all the existing models even the one already migrated into the DB ...

i am stucked with that since a lot of weeks now

Thread Thread
 
a3n3d3i profile image
Andi

In case you do some manual modifications to your database and want the django migrations to "think it did it" you could fake the specific migration by using the "python manage.py migrate --fake yourAppName 00nn_migration_number" command.
This will mark the migrations as applied without modifying the database tables field.