1
0
mirror of https://github.com/django/django.git synced 2025-10-23 21:59:11 +00:00

Adding 'sqlmigrate' command and quote_parameter to support it.

This commit is contained in:
Andrew Godwin
2013-09-06 15:27:51 -05:00
parent 5ca290f5db
commit efd1e6096e
13 changed files with 169 additions and 22 deletions

View File

@@ -48,6 +48,20 @@ class MigrateTests(MigrationTestBase):
self.assertTableNotExists("migrations_tribble")
self.assertTableNotExists("migrations_book")
@override_settings(MIGRATION_MODULES={"migrations": "migrations.test_migrations"})
def test_sqlmigrate(self):
"""
Makes sure that sqlmigrate does something.
"""
# Test forwards. All the databases agree on CREATE TABLE, at least.
stdout = six.StringIO()
call_command("sqlmigrate", "migrations", "0001", stdout=stdout)
self.assertIn("create table", stdout.getvalue().lower())
# And backwards is a DROP TABLE
stdout = six.StringIO()
call_command("sqlmigrate", "migrations", "0001", stdout=stdout, backwards=True)
self.assertIn("drop table", stdout.getvalue().lower())
class MakeMigrationsTests(MigrationTestBase):
"""