Hi, it's me again.
I'm managing migrations myself without using builtin migrations.
My project is using many databases and I'm calling schema migration separately for each database, providing database alias as a command argument.
I'm also emitting pre- and post- migrate signals.
The problem is with new Django (teste with 1.8.3).
When updating schema for 'default' database (which contains all Django-related tables, like auth, contenttypes, and so on), evertyhing works well.
But when updating other databases (without auth, contenttypes, etc), and when emitting post migrate signal with database alias other than 'default', Django is reading all registered apps and calls (for example) "django.auth.management.create_permissions", even if Permission model (or ContentType) is routed to 'default' alias. As a result Django tries to insert data into tables whose does not exists in specified database.
I can bypass emitting signals for databases other than 'default', but the problem still remains in Django itself.
I think that Django should use database routers to check whether model is managed/writeable.
Let's assume that we have two databases: 'default' an 'other'.
Signal is emitting with db alias 'other'.
Then tries to get ContentType using='other'. But the 'other' database has no such table.
Is that feature or bug?
Should I create contrib.* tables for each database?
Kind Regards,
Marcin