Fix for report migration (#7438)

- Check that non-nullable fields are not null
This commit is contained in:
Oliver 2024-06-13 11:34:58 +10:00 committed by GitHub
parent 06ad599e90
commit 4c7a74ef05
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -36,6 +36,8 @@ def convert_legacy_labels(table_name, model_name, template_model):
'name', 'description', 'label', 'enabled', 'height', 'width', 'filename_pattern', 'filters'
]
non_null_fields = ['decription', 'filename_pattern', 'filters']
fieldnames = ', '.join(fields)
query = f"SELECT {fieldnames} FROM {table_name};"
@ -56,6 +58,10 @@ def convert_legacy_labels(table_name, model_name, template_model):
fields[idx]: row[idx] for idx in range(len(fields))
}
for field in non_null_fields:
if data[field] is None:
data[field] = ''
# Skip any "builtin" labels
if 'label/inventree/' in data['label']:
continue