#32083 closed Cleanup/optimization (fixed)
Multiple Databases example suggest explaining migrate requires --database be specified for non-default
Reported by: | Tom Weber | Owned by: | Carlton Gibson |
---|---|---|---|
Component: | Documentation | Version: | 3.1 |
Severity: | Normal | Keywords: | migrate, multiple, databases |
Cc: | Triage Stage: | Ready for checkin | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | yes | UI/UX: | no |
Description
In the Multiple Databases section of the documentation it would be extremely helpful to know that the migrate command must be run for each database with --database= for any non-default database. It took me some time to discover this through a stack-overflow post.
This affects all versions.
https://docs.djangoproject.com/en/2.2/topics/db/multi-db/#an-example
https://stackoverflow.com/questions/35609509/django-migrations-with-multiple-databases
Thanks, I hope this helps the community.
Change History (6)
follow-up: 2 comment:1 by , 4 years ago
comment:2 by , 4 years ago
Replying to JamesTrick:
I believe the behaviour is documented here, under the Synchronizing your databases section. Where it says:
The migrate management command operates on one database at a time. By default, it operates on the default database, but by providing the --database option, you can tell it to synchronize a different database.
Perhaps though, we could add a line in the "An Example" section referencing the need to specify the database? Especially since that StackOverflow article has been viewed 13k times.
Django is such a big project, that even though the documentation contains all the information I have ever needed, it is not always where I need it considering related subjects. A reference to the associated migrate section and reminder to specifically run the migrate command for each database would have helped in my scenario.
comment:3 by , 4 years ago
Owner: | changed from | to
---|---|
Status: | new → assigned |
Triage Stage: | Unreviewed → Accepted |
Especially since that StackOverflow article has been viewed 13k times.
I think that's probably the essence of it. I edited the SO Answer to link back to the correct docs section, and opened a PR to link back there from the Example section lower down.
Hopefully that should help people find the docs in question.
comment:4 by , 4 years ago
Has patch: | set |
---|---|
Triage Stage: | Accepted → Ready for checkin |
Version: | → 3.1 |
I believe the behaviour is documented here, under the Synchronizing your databases section. Where it says:
The migrate management command operates on one database at a time. By default, it operates on the default database, but by providing the --database option, you can tell it to synchronize a different database.
Perhaps though, we could add a line in the "An Example" section referencing the need to specify the database? Especially since that StackOverflow article has been viewed 13k times.