Coverage for src/backend/InvenTree/build/migrations/0050_auto_20240508_0138.py: 75%
10 statements
« prev ^ index » next coverage.py v7.15.2, created at 2026-10-07 17:47 +0000
« prev ^ index » next coverage.py v7.15.2, created at 2026-10-07 17:47 +0000
1# Generated by Django 4.2.12 on 2024-05-08 01:38
3from django.db import migrations
6def forward(apps, schema_editor):
7 """Find and delete any BuildItem instances which have a null BuildLine field."""
9 BuildItem = apps.get_model('build', 'BuildItem')
11 items = BuildItem.objects.filter(build_line=None)
13 if items.count() > 0: 13 ↛ 14line 13 didn't jump to line 14 because the condition on line 13 was never true
14 print(f"Deleting {items.count()} BuildItem objects with null BuildLine field")
15 items.delete()
18class Migration(migrations.Migration):
20 dependencies = [
21 ('build', '0049_alter_builditem_build_line'),
22 ]
24 operations = [
25 migrations.RunPython(forward, reverse_code=migrations.RunPython.noop),
26 ]