Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

migrations: Enforce evaluation order in 0306 WHERE clause.

Anders Kaseorg69890f36b185
diff --git a/zerver/migrations/0306_custom_profile_field_date_format.py b/zerver/migrations/0306_custom_profile_field_date_format.py
index 14fd87fbb84..db006cefcac 100644
--- a/zerver/migrations/0306_custom_profile_field_date_format.py
+++ b/zerver/migrations/0306_custom_profile_field_date_format.py
@@ -20,7 +20,10 @@ class Migration(migrations.Migration):
FROM zerver_customprofilefield AS f
WHERE f.id = field_id
AND f.field_type = 4
- AND value <> to_char(to_date(value, 'YYYY-MM-DD'), 'YYYY-MM-DD');
+ AND CASE
+ WHEN f.field_type = 4
+ THEN value <> to_char(to_date(value, 'YYYY-MM-DD'), 'YYYY-MM-DD')
+ END;
""",
reverse_sql="",
),