Django migrations with multiple databases

You have to run migrate once for each database, specifying the target with --database. Each time it will consult your router to see which migrations to actually perform on that database.

I’m guessing it was designed this way to favor explicitness over implicitness. For example, your workflow might require you to migrate the different databases at different times.

Note, though, that you won’t be able to tell from the output which migrations were actually performed, since:

If allow_migrate() returns False, any migration operations for the model_name will be silently skipped when running migrate on the db.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)