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:
Prakhar Pratyush 2024-07-16 15:00:18 +05:30 committed by Tim Abbott
parent 7d379e00b0
commit 762b1c0f5b
1 changed files with 2 additions and 2 deletions

View File

@ -514,7 +514,7 @@ def re_map_foreign_keys(
"""
# See comments in bulk_import_user_message_data.
assert "usermessage" not in related_table
assert related_table != "usermessage"
re_map_foreign_keys_internal(
data[table],
@ -692,7 +692,7 @@ def update_model_ids(model: Any, data: TableData, related_table: TableName) -> N
# Important: remapping usermessage rows is
# not only unnecessary, it's expensive and can cause
# 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)
allocated_id_list = allocate_ids(model, len(data[table]))