Opened 5 years ago
Closed 5 years ago
#31151 closed New feature (wontfix)
Automatically create a database from database config settings
Reported by: | Tasawar Hussain | Owned by: | nobody |
---|---|---|---|
Component: | Migrations | Version: | 3.0 |
Severity: | Normal | Keywords: | Database |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
Coming from rails background where rails db:create
create a new database from database.yml
. So script like python manage create_database
should be able to create a new database from database config in settings.py
.
Note:
See TracTickets
for help on using tickets.
Hi. Thanks for the report.
In all but this simplest cases, the credentials in settings.py are not sufficient to enable database creation too. Given that in those cases creating the DB doesn't involved much more than a
createdb
on the command line or aCREATE DATABASE...;
from the DB shell, and that creating a DB is a relatively rare event, easily scripted, it's been considered as not worth the complication, and security implications to add this.Some history: #4528, https://groups.google.com/d/topic/django-developers/gX8gJTYRGqI/discussion, https://groups.google.com/d/topic/django-developers/5WO3oh2KTiA/discussion
(But I couldn't find an exact duplicate, somewhat amazingly)