Opened 16 years ago
Closed 16 years ago
#7332 closed (wontfix)
No superuser created on syncdb if database permission errors
Reported by: | Owned by: | nobody | |
---|---|---|---|
Component: | Core (Management commands) | Version: | 0.96 |
Severity: | Keywords: | syncdb, superuser | |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
Ran manage.py syncdb - it completed some tasks but failed on ALTER TABLE statements as I'd forgotten some permissions for the DB user. Same again for indexes - fixed and re-ran.
Then, the app worked fine however at no point was I asked to set a superuser account and the auth_user table was empty.
Workaround: remove DB contents and start again with proper user permissions.
Note:
See TracTickets
for help on using tickets.
This is one of those unfortunate cases where the effort involved in correctly identifying and dealing with the problem vastly exceeds the benefits of fixing the problem. Identifying mid-sync failures will always be fraught with difficulty, and if we get it wrong we could mess up the database (either producing database errors, or by inserting duplicate data into the management tables).
As the reporter states, the simple workaround is to flush the database and start from scratch; the slight less attractive workaround is to let the user manually fix any defects in the database. Neither of these options are particularly attractive, but both of them will be more reliable than an automated system.
The specific problem here is that the user wasn't prompted to create a superuser - this only happens when the auth application is synchronized for the first time. If this is the only problem that has been experienced, the solution may be to simply make the process of adding a superuser easier. There is an accepted ticket to add a 'create superuser' command to manage.py (#5614) which will meet this goal.