diff --git a/zerver/migrations/0037_disallow_null_string_id.py b/zerver/migrations/0037_disallow_null_string_id.py index ceb64a660e..db25111fe1 100644 --- a/zerver/migrations/0037_disallow_null_string_id.py +++ b/zerver/migrations/0037_disallow_null_string_id.py @@ -19,10 +19,11 @@ def set_string_id_using_domain(apps: StateApps, schema_editor: BaseDatabaseSchem try: realm.string_id = prefix + str(i) realm.save(update_fields=["string_id"]) - continue + break except IntegrityError: pass - raise RuntimeError(f"Unable to find a good string_id for realm {realm}") + else: + raise RuntimeError(f"Unable to find a good string_id for realm {realm}") class Migration(migrations.Migration):