Skip to content

Commit 3dc0113

Browse files
committed
Add migration test files for drop table issue
1 parent e98f399 commit 3dc0113

File tree

2 files changed

+38
-0
lines changed

2 files changed

+38
-0
lines changed
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
from django.db import migrations, models
2+
3+
4+
class Migration(migrations.Migration):
5+
6+
dependencies = [
7+
('testapp', '0007_test_remove_onetoone_field_part2'),
8+
]
9+
10+
operations = [
11+
migrations.CreateModel(
12+
name="Pony",
13+
fields=[
14+
("id", models.AutoField(primary_key=True)),
15+
]),
16+
migrations.CreateModel(
17+
name="Rider",
18+
fields=[
19+
("id", models.AutoField(primary_key=True)),
20+
("pony", models.ForeignKey("testapp.Pony", models.CASCADE)),
21+
]),
22+
]
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
from django.db import migrations, models
2+
3+
4+
class Migration(migrations.Migration):
5+
'''
6+
Sql server will generate a error if drop a table that is referenced by a foreign key constraint.
7+
This test is to check if the table can be dropped correctly.
8+
'''
9+
dependencies = [
10+
('testapp', '0008_test_drop_table_with_foreign_key_reference_part1'),
11+
]
12+
13+
operations = [
14+
migrations.DeleteModel("Pony"),
15+
migrations.DeleteModel("Rider"),
16+
]

0 commit comments

Comments
 (0)