Skip to content

Commit

Permalink
fixup!
Browse files Browse the repository at this point in the history
  • Loading branch information
dni committed Oct 15, 2024
1 parent 99dca23 commit 3e23e7a
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions migrations.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,11 +76,9 @@ async def m003_add_id_and_tag(db):
);
"""
)

for row in [
list(row)
for row in await db.fetchall("SELECT * FROM splitpayments.splitpayments_old")
]:
result = await db.execute("SELECT * FROM splitpayments.splitpayments_old")
rows = await result.mappings().all()
for row in rows:
await db.execute(
"""
INSERT INTO splitpayments.targets (
Expand All @@ -91,9 +89,16 @@ async def m003_add_id_and_tag(db):
tag,
alias
)
VALUES (?, ?, ?, ?, ?, ?)
VALUES (:id, :wallet, :source, :percent, :tag, :alias)
""",
(urlsafe_short_hash(), row[0], row[1], row[2], "", row[3]),
{
"id": urlsafe_short_hash(),
"wallet": row["wallet"],
"source": row["source"],
"percent": row["percent"],
"tag": row["tag"],
"alias": row["alias"],
},
)

await db.execute("DROP TABLE splitpayments.splitpayments_old")
Expand Down

0 comments on commit 3e23e7a

Please sign in to comment.