Skip to content

Commit

Permalink
fix(robot-server): update data_files_table with uploaded source (#16813)
Browse files Browse the repository at this point in the history
  • Loading branch information
TamarZanzouri authored Nov 14, 2024
1 parent a0fe00f commit 6d62bec
Showing 1 changed file with 4 additions and 12 deletions.
16 changes: 4 additions & 12 deletions robot-server/robot_server/persistence/_migrations/v6_to_v7.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,16 +100,8 @@ def _migrate_data_files_table_with_new_source_col(
dest_transaction: sqlalchemy.engine.Connection,
) -> None:
"""Add a new 'source' column to data_files table."""
select_data_files = sqlalchemy.select(schema_7.data_files_table).order_by(
sqlite_rowid
)
insert_new_data = sqlalchemy.insert(schema_7.data_files_table)
for old_row in dest_transaction.execute(select_data_files).all():
dest_transaction.execute(
insert_new_data,
id=old_row.id,
name=old_row.name,
file_hash=old_row.file_hash,
created_at=old_row.created_at,
source=DataFileSourceSQLEnum.UPLOADED,
dest_transaction.execute(
sqlalchemy.update(schema_7.data_files_table).values(
{"source": DataFileSourceSQLEnum.UPLOADED}
)
)

0 comments on commit 6d62bec

Please sign in to comment.