import: Add code to support import and export of NamedUserGroups.

This commit is contained in:
Sahil Batra
2024-04-16 14:40:31 +05:30
committed by Tim Abbott
parent b60d5b6fc9
commit c9a7c13ea7
3 changed files with 64 additions and 2 deletions

View File

@@ -45,6 +45,7 @@ from zerver.models import (
Huddle,
Message,
MutedUser,
NamedUserGroup,
OnboardingStep,
Reaction,
Realm,
@@ -244,8 +245,6 @@ NON_EXPORTED_TABLES = {
"zerver_submessage",
# Drafts don't need to be exported as they are supposed to be more ephemeral.
"zerver_draft",
# NamedUserGroup is not exported temporarily, will be done in the next few commits.
"zerver_namedusergroup",
# For any tables listed below here, it's a bug that they are not present in the export.
}
@@ -779,6 +778,14 @@ def get_realm_config() -> Config:
exclude=["direct_members", "direct_subgroups"],
)
Config(
table="zerver_namedusergroup",
model=NamedUserGroup,
normal_parent=realm_config,
include_rows="realm_for_sharding_id__in",
exclude=["realm", "direct_members", "direct_subgroups"],
)
Config(
table="zerver_usergroupmembership",
model=UserGroupMembership,