re-apply migrations on restored database

331 views
Skip to first unread message

Héctor Urbina

unread,
Oct 30, 2014, 2:07:38 PM10/30/14
to django...@googlegroups.com
Hello,

I'm working on a development branch for a django (1.7) project. I have a couple of migrations, including a data migration, in this branch; and I already applied the migrations. After that, I took a dump of the production database (which didn't have those migrations, of course) and restored it to use in development. So, first thing I need to do is to re-apply all the development migrations to the database "again", but django says "no migrations to apply".

I can't find in the documentation how is that django knows what migrations have been applied so far, or if there is a way of changing that, in order to re-apply them.

Any help would be appreciated,

Hector.

--
Héctor Urbina S.
Ingeniero en Bioinformática
Fono: 82049138

Markus Holtermann

unread,
Oct 30, 2014, 2:16:21 PM10/30/14
to django...@googlegroups.com, Héctor Urbina
Hey Hector,

There is a database table called "django_migrations" that is used to keep track of the applied migrations. I guess it's not documented, because touching it shouldn't ever be necessary.

It would be interesting to see how you ended up in a state that Django thinks all migrations have been applied, though.

/Markus
Sent from my Android device with K-9 Mail. Please excuse my brevity.

Héctor Urbina

unread,
Oct 30, 2014, 2:24:31 PM10/30/14
to Markus Holtermann, django...@googlegroups.com
a ha!

I see the table on the restored database. I always though that running the dump.sql would build an exact copy of the original database, but now I'm thinking it just drops and rebuilds the existing original tables. I will manually drop my dev database and then restore the dump again... and see what happens...

Thanks,
H.
Reply all
Reply to author
Forward
0 new messages