From fa42cf77b26bc1f09f9d62bc14338b295d700d87 Mon Sep 17 00:00:00 2001 From: Shai Berger Date: Wed, 11 Jun 2014 20:25:02 +0300 Subject: [PATCH] [1.7.x] Fixed #22487: Separated schema migration from data migration in test The data migration failed on Oracle, killing the entire test suite. Thanks timo for reporting the Oracle breakage, and andrewgodwin for suggesting the solution. Backport of 64d94cf from master --- .../migrations/0001_initial.py | 11 --------- .../migrations/0002_add_book.py | 23 +++++++++++++++++++ 2 files changed, 23 insertions(+), 11 deletions(-) create mode 100644 tests/migration_test_data_persistence/migrations/0002_add_book.py diff --git a/tests/migration_test_data_persistence/migrations/0001_initial.py b/tests/migration_test_data_persistence/migrations/0001_initial.py index 0b13e8b200..d49c47b188 100644 --- a/tests/migration_test_data_persistence/migrations/0001_initial.py +++ b/tests/migration_test_data_persistence/migrations/0001_initial.py @@ -4,14 +4,6 @@ from __future__ import unicode_literals from django.db import models, migrations -def add_book(apps, schema_editor): - apps.get_model("migration_test_data_persistence", "Book").objects.using( - schema_editor.connection.alias, - ).create( - title="I Love Django", - ) - - class Migration(migrations.Migration): dependencies = [ @@ -28,7 +20,4 @@ class Migration(migrations.Migration): }, bases=(models.Model,), ), - migrations.RunPython( - add_book, - ), ] diff --git a/tests/migration_test_data_persistence/migrations/0002_add_book.py b/tests/migration_test_data_persistence/migrations/0002_add_book.py new file mode 100644 index 0000000000..6ce7fff26b --- /dev/null +++ b/tests/migration_test_data_persistence/migrations/0002_add_book.py @@ -0,0 +1,23 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import migrations + + +def add_book(apps, schema_editor): + apps.get_model("migration_test_data_persistence", "Book").objects.using( + schema_editor.connection.alias, + ).create( + title="I Love Django", + ) + + +class Migration(migrations.Migration): + + dependencies = [("migration_test_data_persistence", "0001_initial")] + + operations = [ + migrations.RunPython( + add_book, + ), + ]