[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
This commit is contained in:
parent
45e47f7b95
commit
fa42cf77b2
|
@ -4,14 +4,6 @@ from __future__ import unicode_literals
|
||||||
from django.db import models, migrations
|
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):
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
dependencies = [
|
dependencies = [
|
||||||
|
@ -28,7 +20,4 @@ class Migration(migrations.Migration):
|
||||||
},
|
},
|
||||||
bases=(models.Model,),
|
bases=(models.Model,),
|
||||||
),
|
),
|
||||||
migrations.RunPython(
|
|
||||||
add_book,
|
|
||||||
),
|
|
||||||
]
|
]
|
||||||
|
|
|
@ -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,
|
||||||
|
),
|
||||||
|
]
|
Loading…
Reference in New Issue