Code

Opened 4 years ago

Closed 4 years ago

Last modified 3 years ago

#14662 closed (invalid)

auth and contenttypes post-syncdb handlers ignore 'db' option

Reported by: marcop Owned by: nobody
Component: Contrib apps Version: master
Severity: Keywords: management muti_db
Cc: Triage Stage: Unreviewed
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: yes
Easy pickings: UI/UX:

Description

to reproduce:

  1. set up two databases in settings: 'default' and 'other'
  2. make sure database 'default' is not created
  3. call command python manage.py syncdb --database=other

attached patch solves the problem

tests attached too.

P.S. also added new --database option to createsuperuser command

Attachments (3)

multidb_management_patch.diff (7.4 KB) - added by marcop 4 years ago.
multidb_management_tests.diff (1.8 KB) - added by marcop 4 years ago.
multidb_management_patch.2.diff (7.2 KB) - added by marcop 4 years ago.

Download all attachments as: .zip

Change History (7)

Changed 4 years ago by marcop

Changed 4 years ago by marcop

Changed 4 years ago by marcop

comment:1 Changed 4 years ago by marcop

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement set

please use multidb_management_patch.2.diff and not the first one attached

comment:2 Changed 4 years ago by adamv

Somewhat related to this issue, I think: http://code.djangoproject.com/ticket/12767

comment:3 Changed 4 years ago by russellm

  • milestone set to 1.3
  • Resolution set to invalid
  • Status changed from new to closed

The contenttype and auth post_syncdb handlers ignore --db by design -- they should be (and are) using the router to determine where content types should be written.

If running sycndb on other causes an error because default doesn't exist, then that means you have a dependency in your database setup, and you need to run sycndb on default first. #14799 was the manifestation of this problem in the test suite.

Similarly, createsuperuser shoudn't be overriding the default routing behavior for the User model.

comment:4 Changed 3 years ago by jacob

  • milestone 1.3 deleted

Milestone 1.3 deleted

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.