Skip to content

Commit 9b43fc6

Browse files
committed
fix(migration): data migration purchased→created + remove choices constraint from Shipment.status
1 parent 641984d commit 9b43fc6

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
from django.db import migrations, models
2+
3+
4+
def rename_purchased_to_created(apps, schema_editor):
5+
Shipment = apps.get_model("manager", "Shipment")
6+
Shipment.objects.filter(status="purchased").update(status="created")
7+
8+
9+
class Migration(migrations.Migration):
10+
11+
dependencies = [
12+
("manager", "0088_shipment_order_id"),
13+
]
14+
15+
operations = [
16+
migrations.RunPython(
17+
rename_purchased_to_created,
18+
migrations.RunPython.noop,
19+
),
20+
migrations.AlterField(
21+
model_name="shipment",
22+
name="status",
23+
field=models.CharField(
24+
max_length=50,
25+
db_index=True,
26+
default="draft",
27+
),
28+
),
29+
]

0 commit comments

Comments
 (0)