1
0
mirror of https://github.com/django/django.git synced 2025-11-07 07:15:35 +00:00

[1.7.x] Implement Migration.run_before

This attribute (used for reverse dependencies) was previously declared
and mentioned in the code, but never actually used.
This commit is contained in:
Chris Beaven
2014-05-29 22:30:47 +12:00
committed by Andrew Godwin
parent 31fc34e447
commit 9f1c4e4d3f
6 changed files with 115 additions and 17 deletions

View File

@@ -0,0 +1,20 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
operations = [
migrations.CreateModel(
"Salamander",
[
("id", models.AutoField(primary_key=True)),
("size", models.IntegerField(default=0)),
("silly_field", models.BooleanField(default=False)),
],
),
]

View File

@@ -0,0 +1,23 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("migrations", "0001_initial"),
]
operations = [
migrations.CreateModel(
"Book",
[
("id", models.AutoField(primary_key=True)),
("author", models.ForeignKey("migrations.Author", null=True)),
],
)
]

View File

@@ -0,0 +1,32 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
"""
This is a wee bit crazy, but it's just to show that run_before works.
"""
dependencies = [
("migrations", "0001_initial"),
]
run_before = [
("migrations", "0002_second"),
]
operations = [
migrations.CreateModel(
"Author",
[
("id", models.AutoField(primary_key=True)),
("name", models.CharField(max_length=255)),
("slug", models.SlugField(null=True)),
("age", models.IntegerField(default=0)),
],
)
]