{{{
#!python
DATABASES = {
'default': {},
'users': {
'NAME': 'user_data',
'ENGINE': 'django.db.backends.mysql',
'USER': 'mysql_user',
'PASSWORD': 'superS3cret'
},
'customers': {
'NAME': 'customer_data',
'ENGINE': 'django.db.backends.mysql',
'USER': 'mysql_cust',
'PASSWORD': 'veryPriv@ate'
}
}
}}}
Here is the related source code:
https://github.com/django/django/blob/f97a6123c07de5099fdf8b7d00ef7d20ed354e07/django/db/models/fields/__init__.py#L340
We only run checks for the first db, and the behavior of the first is
undetermined (the first entry of a dictionary),
if the first db is `default`, then we would only run dummy backend checks,
mysql checks are bypassed.
--
Ticket URL: <https://code.djangoproject.com/ticket/31019>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
Old description:
> Here is the settings:
>
> {{{
> #!python
> DATABASES = {
> 'default': {},
> 'users': {
> 'NAME': 'user_data',
> 'ENGINE': 'django.db.backends.mysql',
> 'USER': 'mysql_user',
> 'PASSWORD': 'superS3cret'
> },
> 'customers': {
> 'NAME': 'customer_data',
> 'ENGINE': 'django.db.backends.mysql',
> 'USER': 'mysql_cust',
> 'PASSWORD': 'veryPriv@ate'
> }
> }
> }}}
>
> Here is the related source code:
> https://github.com/django/django/blob/f97a6123c07de5099fdf8b7d00ef7d20ed354e07/django/db/models/fields/__init__.py#L340
>
> We only run checks for the first db, and the behavior of the first is
> undetermined (the first entry of a dictionary),
> if the first db is `default`, then we would only run dummy backend
> checks, mysql checks are bypassed.
New description:
Here is the settings:
{{{
#!python
DATABASES = {
'default': {},
'users': {
'NAME': 'user_data',
'ENGINE': 'django.db.backends.mysql',
'USER': 'mysql_user',
'PASSWORD': 'superS3cret'
},
}
}}}
Here is the related source code:
https://github.com/django/django/blob/f97a6123c07de5099fdf8b7d00ef7d20ed354e07/django/db/models/fields/__init__.py#L340
We only run checks for the first db, and the behavior of the first is
undetermined (the first entry of a dictionary),
if the first db is `default`, then we would only run dummy backend checks,
mysql checks are bypassed.
--
--
Ticket URL: <https://code.djangoproject.com/ticket/31019#comment:1>
Old description:
> Here is the settings:
>
> {{{
> #!python
> DATABASES = {
> 'default': {},
> 'users': {
> 'NAME': 'user_data',
> 'ENGINE': 'django.db.backends.mysql',
> 'USER': 'mysql_user',
> 'PASSWORD': 'superS3cret'
> },
> }
> }}}
>
> Here is the related source code:
> https://github.com/django/django/blob/f97a6123c07de5099fdf8b7d00ef7d20ed354e07/django/db/models/fields/__init__.py#L340
>
> We only run checks for the first db, and the behavior of the first is
> undetermined (the first entry of a dictionary),
> if the first db is `default`, then we would only run dummy backend
> checks, mysql checks are bypassed.
New description:
Here is the settings:
{{{
#!python
DATABASES = {
'default': {},
'users': {
'NAME': 'user_data',
'ENGINE': 'django.db.backends.mysql',
'USER': 'mysql_user',
'PASSWORD': 'superS3cret'
},
}
}}}
Here is the related source code:
https://github.com/django/django/blob/f97a6123c07de5099fdf8b7d00ef7d20ed354e07/django/db/models/fields/__init__.py#L340
We only run checks for the first db, and the behavior of the first db is
undetermined (the first entry of a dictionary),
if the first db is `default`, then we would only run dummy backend checks,
mysql checks are bypassed.
--
--
Ticket URL: <https://code.djangoproject.com/ticket/31019#comment:2>
* status: new => closed
* resolution: => invalid
Comment:
You're router should define
[https://docs.djangoproject.com/en/2.2/topics/db/multi-db/#allow_migrate
allow_migrate()] method that will return `True` only for the `customer`
db.
Closing per TicketClosingReasons/UseSupportChannels.
--
Ticket URL: <https://code.djangoproject.com/ticket/31019#comment:3>
Comment (by Shipeng Feng):
I couldn't find any documentation for this, is this documented anywhere?
Or we could add some notices about this in the documentation
so that others won't encounter the same problem.
--
Ticket URL: <https://code.djangoproject.com/ticket/31019#comment:4>
Comment (by felixxm):
`allow_migrate()` is [https://docs.djangoproject.com/en/2.2/topics/db
/multi-db/#allow_migrate documented] also you should also read carefully
the entire [https://docs.djangoproject.com/en/2.2/topics/db/multi-db
Multiple databases topic].
--
Ticket URL: <https://code.djangoproject.com/ticket/31019#comment:5>