#1640 closed defect (fixed)
A little bit more for creating indexes automatically
| Reported by: | Owned by: | Adrian Holovaty | |
|---|---|---|---|
| Component: | Core (Management commands) | Version: | |
| Severity: | normal | Keywords: | |
| Cc: | Triage Stage: | Unreviewed | |
| Has patch: | no | Needs documentation: | no |
| Needs tests: | no | Patch needs improvement: | no |
| Easy pickings: | no | UI/UX: | no |
Description
I submitted ticket #1508 to create indexes when creating databases, but I missed one thing: the indexes on the core tables. This patch adds that as well.
--- site-packages/django/core/management.py (revision 3838)
+++ site-packages/django/core/management.py (revision 3839)
@@ -371,13 +371,13 @@
"Initializes the database with auth and core."
try:
from django.core import db, meta
auth = meta.get_app('auth')
core = meta.get_app('core')
cursor = db.db.cursor()
- for sql in get_sql_create(core) + get_sql_create(auth) + get_sql_initial_data(core) + get_sql_initial_data(auth):
+ for sql in get_sql_create(core) + get_sql_create(auth) + get_sql_initial_data(core) + get_sql_initial_data(auth) + get_sql_indexes(core) + get_sql_indexes(auth):
cursor.execute(sql)
cursor.execute("INSERT INTO %s (%s, %s) VALUES ('example.com', 'Example site')" % \
(db.db.quote_name(core.Site._meta.db_table), db.db.quote_name('domain'),
db.db.quote_name('name')))
except Exception, e:
sys.stderr.write("Error: The database couldn't be initialized.\n%s\n" % e)
Note:
See TracTickets
for help on using tickets.
No longer an issue with magic-removal merged.