-
-
Notifications
You must be signed in to change notification settings - Fork 31.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix migration planner to fully understand squashed migrations. And test.
- Loading branch information
1 parent
4cfbde7
commit 5ab8b5d
Showing
9 changed files
with
207 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,27 @@ | |||
from django.db import migrations, models | |||
|
|||
|
|||
class Migration(migrations.Migration): | |||
|
|||
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)), | |||
("silly_field", models.BooleanField(default=False)), | |||
], | |||
), | |||
|
|||
migrations.CreateModel( | |||
"Tribble", | |||
[ | |||
("id", models.AutoField(primary_key=True)), | |||
("fluffy", models.BooleanField(default=True)), | |||
], | |||
) | |||
|
|||
] |
32 changes: 32 additions & 0 deletions
32
tests/migrations/test_migrations_squashed/0001_squashed_0002.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,32 @@ | |||
from django.db import migrations, models | |||
|
|||
|
|||
class Migration(migrations.Migration): | |||
|
|||
replaces = [ | |||
("migrations", "0001_initial"), | |||
("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)), | |||
("rating", models.IntegerField(default=0)), | |||
], | |||
), | |||
|
|||
migrations.CreateModel( | |||
"Book", | |||
[ | |||
("id", models.AutoField(primary_key=True)), | |||
("author", models.ForeignKey("migrations.Author", null=True)), | |||
], | |||
), | |||
|
|||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,24 @@ | |||
from django.db import migrations, models | |||
|
|||
|
|||
class Migration(migrations.Migration): | |||
|
|||
dependencies = [("migrations", "0001_initial")] | |||
|
|||
operations = [ | |||
|
|||
migrations.DeleteModel("Tribble"), | |||
|
|||
migrations.RemoveField("Author", "silly_field"), | |||
|
|||
migrations.AddField("Author", "rating", models.IntegerField(default=0)), | |||
|
|||
migrations.CreateModel( | |||
"Book", | |||
[ | |||
("id", models.AutoField(primary_key=True)), | |||
("author", models.ForeignKey("migrations.Author", null=True)), | |||
], | |||
) | |||
|
|||
] |
Empty file.