Merge remote-tracking branch 'core/master' into schema-alteration

Conflicts:
	django/db/models/loading.py
This commit is contained in:
Andrew Godwin 2013-06-19 12:03:20 +01:00
commit 9daf81b94e
161 changed files with 3128 additions and 1220 deletions

View file

@ -302,14 +302,17 @@ class DatabaseOperations(BaseDatabaseOperations):
def random_function_sql(self):
return 'RAND()'
def sql_flush(self, style, tables, sequences):
def sql_flush(self, style, tables, sequences, allow_cascade=False):
# NB: The generated SQL below is specific to MySQL
# 'TRUNCATE x;', 'TRUNCATE y;', 'TRUNCATE z;'... style SQL statements
# to clear all tables of all data
if tables:
sql = ['SET FOREIGN_KEY_CHECKS = 0;']
for table in tables:
sql.append('%s %s;' % (style.SQL_KEYWORD('TRUNCATE'), style.SQL_FIELD(self.quote_name(table))))
sql.append('%s %s;' % (
style.SQL_KEYWORD('TRUNCATE'),
style.SQL_FIELD(self.quote_name(table)),
))
sql.append('SET FOREIGN_KEY_CHECKS = 1;')
sql.extend(self.sequence_reset_by_name_sql(style, sequences))
return sql