From c2a2cb0529207af5f39aa5b1690dae82b14de62e Mon Sep 17 00:00:00 2001 From: Dishen <44216194+DishenWang2023@users.noreply.github.com> Date: Fri, 6 Oct 2023 15:26:22 -0500 Subject: [PATCH] DH-4778 fix migration script (#211) --- .../sprint_60/DH-4778_version_history_refactor.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/apps/ai/server/database/migrations/sprint_60/DH-4778_version_history_refactor.py b/apps/ai/server/database/migrations/sprint_60/DH-4778_version_history_refactor.py index 42f12893..e9fd6883 100644 --- a/apps/ai/server/database/migrations/sprint_60/DH-4778_version_history_refactor.py +++ b/apps/ai/server/database/migrations/sprint_60/DH-4778_version_history_refactor.py @@ -36,8 +36,10 @@ if query_response: question_id = ObjectId(query_response["question_id"]) - updated_by = ObjectId(doc["updated_by"]) - + if "updated_by" in doc: + updated_by = ObjectId(doc["updated_by"]) + else: + updated_by = None # add new field question id, change updated_by to ObjectId data_store[query_collection].update_one( {"_id": doc["_id"]},