mirror of https://github.com/zulip/zulip.git
import_realm: Improve assert statements verifying table name.
This commit improves the assert statements to verify that the table name is not "usermessage' instead of verifying that table name doesn't include a substring "usermessage". This prep commit will help to avoid assertion error when importing "onboardingusermessage" table.
This commit is contained in:
parent
7d379e00b0
commit
762b1c0f5b
|
@ -514,7 +514,7 @@ def re_map_foreign_keys(
|
||||||
"""
|
"""
|
||||||
|
|
||||||
# See comments in bulk_import_user_message_data.
|
# See comments in bulk_import_user_message_data.
|
||||||
assert "usermessage" not in related_table
|
assert related_table != "usermessage"
|
||||||
|
|
||||||
re_map_foreign_keys_internal(
|
re_map_foreign_keys_internal(
|
||||||
data[table],
|
data[table],
|
||||||
|
@ -692,7 +692,7 @@ def update_model_ids(model: Any, data: TableData, related_table: TableName) -> N
|
||||||
# Important: remapping usermessage rows is
|
# Important: remapping usermessage rows is
|
||||||
# not only unnecessary, it's expensive and can cause
|
# not only unnecessary, it's expensive and can cause
|
||||||
# memory errors. We don't even use ids from ID_MAP.
|
# memory errors. We don't even use ids from ID_MAP.
|
||||||
assert "usermessage" not in table
|
assert table != "usermessage"
|
||||||
|
|
||||||
old_id_list = current_table_ids(data, table)
|
old_id_list = current_table_ids(data, table)
|
||||||
allocated_id_list = allocate_ids(model, len(data[table]))
|
allocated_id_list = allocate_ids(model, len(data[table]))
|
||||||
|
|
Loading…
Reference in New Issue