mirror of
https://github.com/django/django.git
synced 2025-08-04 02:48:35 +00:00
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:
parent
15ba0d166f
commit
30cbd5d360
6 changed files with 54 additions and 70 deletions
|
@ -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 "
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue