Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
import: Narrow the id-window to just the current realm.
M@47ecd33d3aa7
diff --git a/zerver/lib/import_realm.py b/zerver/lib/import_realm.pyindex ceee4e8181c..480554335c8 100644--- a/zerver/lib/import_realm.py+++ b/zerver/lib/import_realm.py@@ -1328,7 +1328,8 @@ def do_import_realm(import_dir: Path, subdomain: str, processes: int = 1) -> Reabulk_import_model(data, Reaction)# Similarly, we need to recalculate the first_message_id for stream objects.- update_first_message_id_query = """+ update_first_message_id_query = SQL(+ """UPDATE zerver_streamSET first_message_id = subquery.first_message_idFROM (@@ -1336,13 +1337,15 @@ def do_import_realm(import_dir: Path, subdomain: str, processes: int = 1) -> ReaFROM zerver_message mJOIN zerver_recipient r ONr.id = m.recipient_id- WHERE r.type = 2+ WHERE r.type = 2 AND m.realm_id = %(realm_id)sGROUP BY r.type_id) AS subqueryWHERE zerver_stream.id = subquery.id"""+ )+with connection.cursor() as cursor:- cursor.execute(update_first_message_id_query)+ cursor.execute(update_first_message_id_query, {"realm_id": realm.id})if "zerver_userstatus" in data:fix_datetime_fields(data, "zerver_userstatus")