Replaced DatabaseCreation sql methods by schema editor equivalents

Also used schema editor in migrate to sync unmigrated apps (sync_apps).
Refs #22340. Thanks Tim Graham for the review.
This commit is contained in:
Claude Paroz 2014-09-14 20:26:16 +02:00
parent 15ba0d166f
commit 30cbd5d360
6 changed files with 54 additions and 70 deletions

View file

@ -111,9 +111,10 @@ class SQLiteTests(TestCase):
Check that auto_increment fields are created with the AUTOINCREMENT
keyword in order to be monotonically increasing. Refs #10164.
"""
statements = connection.creation.sql_create_model(models.Square,
style=no_style())
match = re.search('"id" ([^,]+),', statements[0][0])
with connection.schema_editor(collect_sql=True) as editor:
editor.create_model(models.Square)
statements = editor.collected_sql
match = re.search('"id" ([^,]+),', statements[0])
self.assertIsNotNone(match)
self.assertEqual('integer NOT NULL PRIMARY KEY AUTOINCREMENT',
match.group(1), "Wrong SQL used to create an auto-increment "