Skip to content

Commit

Permalink
fix: secret type migration
Browse files Browse the repository at this point in the history
  • Loading branch information
danielgrittner committed Nov 5, 2024
1 parent 9e87566 commit 36dec61
Showing 1 changed file with 12 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
def upgrade() -> None:
# ### commands auto generated by Alembic - please adjust! ###

bind = op.get_bind()

integrations = [
("anthropic", "Anthropic"),
("mistral ai", "Mistral AI"),
Expand Down Expand Up @@ -57,17 +59,21 @@ def upgrade() -> None:

for potential_name, secret_type in integrations:
potential_name: str = potential_name.lower()
op.execute(
"UPDATE secrets SET secret_type = :new_type WHERE secret_type LIKE :pattern",
execution_options={
bind.execute(
sqlmodel.text(
"UPDATE secrets SET secret_type = :new_type WHERE secret_type LIKE :pattern"
),
{
"new_type": secret_type,
"pattern": f"%{potential_name}%",
},
)
potential_name = potential_name.replace(" ", "_")
op.execute(
"UPDATE secrets SET secret_type = :new_type WHERE secret_type LIKE :pattern",
execution_options={
bind.execute(
sqlmodel.text(
"UPDATE secrets SET secret_type = :new_type WHERE secret_type LIKE :pattern"
),
{
"new_type": secret_type,
"pattern": f"%{potential_name}%",
},
Expand Down

0 comments on commit 36dec61

Please sign in to comment.