﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
4528	Add DATABASE_PRE_SYNCDB to settings	Johan Bergström <bugs@…>		"DATABASE_PRE_SYNCDB is a way of letting users execute SQL before tables are created (for instance through syncdb).
The main reason for this is users which don't have control over their db - in practise, no rights to set default modes (which has been brought up [http://code.djangoproject.com/ticket/347 earlier]). This would allow users to set the ""correct"" charset and storage engine for his/her tables.
Another useful feature is that django now has the possibility to create a database.[[BR]]
Here's a ""real world"" example:
{{{
#!python
DATABASE_PRE_SYNCDB = (
    ""CREATE DATABASE IF NOT EXISTS %s"" % DATABASE_NAME,
    ""SET storage_engine=INNODB"",
)
}}}

Alternative approaches to this has been suggested, such as:
 * Alter tables ''after'' the table has been created (refs: wiki:AlterModelOnSyncDB)
 * Export SQL, modify and import manually

I personally think this implementation is cleaner and allows greater flexibility."	New feature	closed	Core (Management commands)	dev	Normal	wontfix	database_pre_syncdb sql syncdb	Silver_Ghost	Accepted	1	0	0	0	1	0
