Overclocked
Overclocked

Reputation: 1207

Django South migration to different databases

Does South honor database routers? I set up routers to route certain apps to one DB, and all other apps to the default DB. I even made sure that South migrationhistory table is in both DBs. But I can't get South to only apply migrations in the appropriate DB. I.e. even when I run south with --database, it applies all migrations to the database I specify, rather than just migrations from the app that should go to that DB.

Help! Thanks.

Upvotes: 14

Views: 2100

Answers (1)

Thomas
Thomas

Reputation: 11888

"Does South honor database routers?" No, it does not.

The problem is that Django's DB router routes queries to databases based on Apps/Models, whereas south is based on Tables. South really doesn't have much idea which model a table corresponds to (esp in the history). Andrew Godwin is currently working on a contrib module to django that will replace south and fix a lot of these problems, but right now you have to do a lot of this work manually using hacky methods (--database, .using()).

I'd recomend for the sake of automation, having all tables exist in all databases and running all the migrations against all of those databases too. Just to make sure that all the constraints work consistently across all of the databases.

Upvotes: 10

Related Questions