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

1# Generated by Django 4.2.12 on 2024-05-08 01:38 

2 

3from django.db import migrations 

4 

5 

6def forward(apps, schema_editor): 

7 """Find and delete any BuildItem instances which have a null BuildLine field.""" 

8 

9 BuildItem = apps.get_model('build', 'BuildItem') 

10 

11 items = BuildItem.objects.filter(build_line=None) 

12 

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() 

16 

17 

18class Migration(migrations.Migration): 

19 

20 dependencies = [ 

21 ('build', '0049_alter_builditem_build_line'), 

22 ] 

23 

24 operations = [ 

25 migrations.RunPython(forward, reverse_code=migrations.RunPython.noop), 

26 ]