From a2c4931316d1369542330ac868e64f7702b4aecd Mon Sep 17 00:00:00 2001 From: Steve Howell Date: Wed, 8 Dec 2021 18:43:38 +0000 Subject: [PATCH] exports: Use realm for RealmAuditLog in realm exports. For realm-wide exports, there is no reason to query inefficiently against a list of modified users. We move the Config out of the common child configs. --- zerver/lib/export.py | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/zerver/lib/export.py b/zerver/lib/export.py index afc9f76ed3..82f8f2ac23 100644 --- a/zerver/lib/export.py +++ b/zerver/lib/export.py @@ -655,6 +655,13 @@ def get_realm_config() -> Config: include_rows="realm_id__in", ) + Config( + table="zerver_realmauditlog", + model=RealmAuditLog, + normal_parent=realm_config, + include_rows="realm_id__in", + ) + Config( table="zerver_realmemoji", model=RealmEmoji, @@ -875,13 +882,6 @@ def add_user_profile_child_configs(user_profile_config: Config) -> None: include_rows="user_profile_id__in", ) - Config( - table="zerver_realmauditlog", - model=RealmAuditLog, - normal_parent=user_profile_config, - include_rows="modified_user_id__in", - ) - Config( table="zerver_useractivity", model=UserActivity, @@ -1956,6 +1956,13 @@ def get_single_user_config() -> Config: include_rows="user_id__in", ) + Config( + table="zerver_realmauditlog", + model=RealmAuditLog, + normal_parent=user_profile_config, + include_rows="modified_user_id__in", + ) + add_user_profile_child_configs(user_profile_config) return user_profile_config