Opened 4 years ago

Closed 4 years ago

Last modified 4 years ago

#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)

comment:1 by James Malcolm, 4 years ago

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.

in reply to:  1 comment:2 by Tom Weber, 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 Carlton Gibson, 4 years ago

Owner: changed from nobody to Carlton Gibson
Status: newassigned
Triage Stage: UnreviewedAccepted

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 Carlton Gibson, 4 years ago

Has patch: set
Triage Stage: AcceptedReady for checkin
Version: 3.1

comment:5 by GitHub <noreply@…>, 4 years ago

Resolution: fixed
Status: assignedclosed

In 1b32b2f:

Fixed #32083 -- Added link back to migrating section in multi-db docs example.

comment:6 by Carlton Gibson <carlton.gibson@…>, 4 years ago

In d1f791d:

[3.1.x] Fixed #32083 -- Added link back to migrating section in multi-db docs example.

Backport of 1b32b2f614c5c45f4a0f270ae7273c2d8e16617b from master

Note: See TracTickets for help on using tickets.
Back to Top