diff options
| author | Víðir Valberg Guðmundsson <valberg@orn.li> | 2014-05-29 23:03:10 +0200 |
|---|---|---|
| committer | Andrew Godwin <andrew@aeracode.org> | 2014-06-07 17:18:30 -0700 |
| commit | f70f669941775ceef8433f4c66b189f82d53074f (patch) | |
| tree | a1166430f3a077ad09f2d4fc4d5cdacff1d3232e /tests | |
| parent | 6fd455adfcc85f6bd390bce784a1b5dfe5d610ea (diff) | |
Fixed #22749: Making SQL management commands migration aware.
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/commands_sql_migrations/__init__.py | 0 | ||||
| -rw-r--r-- | tests/commands_sql_migrations/migrations/0001_initial.py | 33 | ||||
| -rw-r--r-- | tests/commands_sql_migrations/migrations/__init__.py | 0 | ||||
| -rw-r--r-- | tests/commands_sql_migrations/models.py | 10 | ||||
| -rw-r--r-- | tests/commands_sql_migrations/tests.py | 2 |
5 files changed, 44 insertions, 1 deletions
diff --git a/tests/commands_sql_migrations/__init__.py b/tests/commands_sql_migrations/__init__.py new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/tests/commands_sql_migrations/__init__.py diff --git a/tests/commands_sql_migrations/migrations/0001_initial.py b/tests/commands_sql_migrations/migrations/0001_initial.py new file mode 100644 index 0000000000..39a53bf68f --- /dev/null +++ b/tests/commands_sql_migrations/migrations/0001_initial.py @@ -0,0 +1,33 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import models, migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ] + + operations = [ + migrations.CreateModel( + name='Comment', + fields=[ + ('id', models.AutoField(verbose_name='ID', primary_key=True, serialize=False, auto_created=True)), + ], + options={ + }, + bases=(models.Model,), + ), + migrations.CreateModel( + name='Book', + fields=[ + ('id', models.AutoField(verbose_name='ID', primary_key=True, serialize=False, auto_created=True)), + ('title', models.CharField(db_index=True, max_length=100)), + ('comments', models.ManyToManyField(to='commands_sql_migrations.Comment')), + ], + options={ + }, + bases=(models.Model,), + ), + ] diff --git a/tests/commands_sql_migrations/migrations/__init__.py b/tests/commands_sql_migrations/migrations/__init__.py new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/tests/commands_sql_migrations/migrations/__init__.py diff --git a/tests/commands_sql_migrations/models.py b/tests/commands_sql_migrations/models.py new file mode 100644 index 0000000000..78ad722307 --- /dev/null +++ b/tests/commands_sql_migrations/models.py @@ -0,0 +1,10 @@ +from django.db import models + + +class Comment(models.Model): + pass + + +class Book(models.Model): + title = models.CharField(max_length=100, db_index=True) + comments = models.ManyToManyField(Comment) diff --git a/tests/commands_sql_migrations/tests.py b/tests/commands_sql_migrations/tests.py index e0fb3559cd..23b37a0f8f 100644 --- a/tests/commands_sql_migrations/tests.py +++ b/tests/commands_sql_migrations/tests.py @@ -20,7 +20,7 @@ class SQLCommandsMigrationsTestCase(TestCase): def test_sql_delete(self): app_config = apps.get_app_config('commands_sql_migrations') with self.assertRaises(CommandError): - sql_delete(app_config, no_style(), connections[DEFAULT_DB_ALIAS]) + sql_delete(app_config, no_style(), connections[DEFAULT_DB_ALIAS], close_connection=False) def test_sql_indexes(self): app_config = apps.get_app_config('commands_sql_migrations') |
