From cbf5b725d9d0b88bbaca087b45dc427e476a35c7 Mon Sep 17 00:00:00 2001 From: callebtc <93376500+callebtc@users.noreply.github.com> Date: Sun, 11 May 2025 21:34:34 +0200 Subject: [PATCH] check for migration first (#750) --- cashu/wallet/migrations.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/cashu/wallet/migrations.py b/cashu/wallet/migrations.py index 6b26250..80dc03a 100644 --- a/cashu/wallet/migrations.py +++ b/cashu/wallet/migrations.py @@ -289,6 +289,15 @@ async def m013_add_mint_and_melt_quote_tables(db: Database): async def m014_add_key_to_mint_quote_table(db: Database): async with db.connect() as conn: + # get column names in bolt11_mint_quotes first + columns = await conn.fetchall( + """ + SELECT name FROM pragma_table_info('bolt11_mint_quotes'); + """ + ) + # check if privkey column already exists + if any(col["name"] == "privkey" for col in columns): + return await conn.execute( """ ALTER TABLE bolt11_mint_quotes