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.
South is a migration tool used with Django. There will be times when you would be adding fields to a model or changing the type of field (eg: Field was an IntegerField and you want to change it to FloatField). In such cases syncdb doesn't help and South comes to your rescue.
You should think of migrations as a version control system for your database schema. makemigrations is responsible for packaging up your model changes into individual migration files - analogous to commits - and migrate is responsible for applying those to your database.
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.
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