Hi,
Using multiple DBs, with most models in the "default" db but models for a single app being stored in a second DB, I've more or less copied the
example from the docs for a custom database router. (My example is essentially identical to the `AuthRouter` class given.)
This works perfectly except when I run the migration on the second DB.
The app relations are all created but I then get an error creating the ContentType...
> RuntimeError: Error creating new content types. Please make sure contenttypes is migrated before trying to migrate apps individually.
This occurs because the relation "django_content_type" does not exist in the second database — that's correct: I'm expecting content types to be written only to the "default" db.
My question is why is this error occurring?
1. As per the docs, in my router, I am returning "None if there is no suggestion" for all the router methods — particularly `db_for_write`, which seems relevant here.
2. Looking at the source, the default router returns `DEFAULT_DB_ALIAS` if all the custom routers return None.
So 3. I can't see the error. :-) — I'm expecting the content type to be written to the default db.
I can work around the issue here — but I'd like to understand it. Can anyone with experience of this explain what I've done wrong?
Kind Regards,
Carlton