1
0
mirror of https://github.com/django/django.git synced 2025-10-30 00:56:09 +00:00

Add a SQlite backend. One test passes!

This commit is contained in:
Andrew Godwin
2012-08-18 14:16:52 +01:00
parent 0b01395108
commit d3d1e59921
3 changed files with 17 additions and 6 deletions

View File

@@ -44,18 +44,18 @@ class SchemaTests(TestCase):
# Remove any M2M tables first
for field in model._meta.local_many_to_many:
try:
cursor.execute("DROP TABLE %s CASCADE" % (
connection.ops.quote_name(field.rel.through._meta.db_table),
))
cursor.execute(connection.schema_editor().sql_delete_table % {
"table": connection.ops.quote_name(field.rel.through._meta.db_table),
})
except DatabaseError:
connection.rollback()
else:
connection.commit()
# Then remove the main tables
try:
cursor.execute("DROP TABLE %s CASCADE" % (
connection.ops.quote_name(model._meta.db_table),
))
cursor.execute(connection.schema_editor().sql_delete_table % {
"table": connection.ops.quote_name(model._meta.db_table),
})
except DatabaseError:
connection.rollback()
else: