Skip to content

Commit f51bdfe

Browse files
committed
Fix 0006 db migrations to avoid overwriting org name with empty strings
1 parent 58163fd commit f51bdfe

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

kobo/apps/organizations/migrations/0006_update_organization_name.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,12 @@ def update_organization_names(apps, schema_editor):
3131
except (KeyError, AttributeError):
3232
continue
3333

34-
organization.name = organization_name
35-
organizations.append(organization)
34+
if organization_name:
35+
organization.name = organization_name
36+
organizations.append(organization)
3637

37-
Organization.objects.bulk_update(organizations, ['name'])
38+
if organizations:
39+
Organization.objects.bulk_update(organizations, ['name'])
3840

3941

4042
def noop(apps, schema_editor):

0 commit comments

Comments
 (0)