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:
@@ -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):
|
||||
"""
|
||||
|
||||
Reference in New Issue
Block a user