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.

export: Sort table data for most tables.

Steve Howellf8ed099d3ce9
diff --git a/zerver/lib/export.py b/zerver/lib/export.py
index 4f9736bf21e..5f464e76799 100644
--- a/zerver/lib/export.py
+++ b/zerver/lib/export.py
@@ -359,6 +359,12 @@ def write_data_to_file(output_file: Path, data: Any) -> None:
def write_table_data(output_file: str, data: Dict[str, Any]) -> None:
+ # We sort by ids mostly so that humans can quickly do diffs
+ # on two export jobs to see what changed (either due to new
+ # data arriving or new code being deployed).
+ for table in data.values():
+ table.sort(key=lambda row: row["id"])
+
assert output_file.endswith(".json")
write_data_to_file(output_file, data)