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'.
Django calls 
https://github.com/django/django/blob/1.8.3/django/contrib/auth/management/__init__.py#L82
 
with 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

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers  (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-developers+unsubscr...@googlegroups.com.
To post to this group, send email to django-developers@googlegroups.com.
Visit this group at http://groups.google.com/group/django-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/8547aa2b-ae44-4cc7-b000-0683f4533789%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to