Skip to content

Commit a336ba0

Browse files
committed
fixed issue in migration
1 parent 0b13280 commit a336ba0

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

backend/src/alembic/versions/970c55224a39_add_repourl_to_sdocdata.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
import sqlalchemy as sa
1212
from sqlalchemy.orm import sessionmaker
13+
from sqlalchemy.sql import text
1314

1415
from alembic import op
1516
from app.core.data.crud.source_document import crud_sdoc
@@ -63,8 +64,9 @@ def upgrade() -> None:
6364

6465
# 4. Update the repo_url field in the Source Document Data table
6566
for sdoc, url in zip(sdocs, urls):
66-
op.execute(
67-
f"UPDATE sourcedocumentdata SET repo_url = '{url}' WHERE id = {sdoc.id}"
67+
conn.execute(
68+
text("UPDATE sourcedocumentdata SET repo_url = :url WHERE id = :id"),
69+
{"url": url, "id": sdoc.id},
6870
)
6971

7072
# change the column to non-nullable

0 commit comments

Comments
 (0)