File tree Expand file tree Collapse file tree 2 files changed +9
-5
lines changed
robot-server/robot_server/persistence/_migrations Expand file tree Collapse file tree 2 files changed +9
-5
lines changed Original file line number Diff line number Diff line change @@ -75,14 +75,17 @@ def _migrate_command_table_with_new_command_intent_col(
75
75
for row in dest_transaction .execute (select_commands ).all ():
76
76
data = json .loads (row .command )
77
77
new_command_intent = (
78
- # Account for old_row.command["intent"] being NULL.
78
+ # Account for the `intent` prop of the old command JSON being omitted or `null`.
79
+ # We convert either case to the SQL string "protocol".
79
80
"protocol"
80
- if "intent" not in row . command or data ["intent" ] == None # noqa: E711
81
+ if "intent" not in data or data ["intent" ] is None
81
82
else data ["intent" ]
82
83
)
83
84
84
85
dest_transaction .execute (
85
- f"UPDATE run_command SET command_intent='{ new_command_intent } ' WHERE row_id={ row .row_id } "
86
+ sqlalchemy .update (schema_7 .run_command_table )
87
+ .where (schema_7 .run_command_table .c .row_id == row .row_id )
88
+ .values (command_intent = new_command_intent ),
86
89
)
87
90
88
91
Original file line number Diff line number Diff line change @@ -81,9 +81,10 @@ def _migrate_command_table_with_new_command_error_col_and_command_status(
81
81
for row in dest_transaction .execute (select_commands ).all ():
82
82
data = json .loads (row .command )
83
83
new_command_error = (
84
- # Account for old_row.command["error"] being null.
84
+ # Account for the `error` prop of the old command JSON being omitted or `null`.
85
+ # We convert either case to SQL `null`.
85
86
None
86
- if "error" not in row . command or data ["error" ] is None
87
+ if "error" not in data or data ["error" ] is None
87
88
else json .dumps (data ["error" ])
88
89
)
89
90
# parse json as enum
You can’t perform that action at this time.
0 commit comments