check for migration first (#750)

This commit is contained in:
callebtc
2025-05-11 21:34:34 +02:00
committed by GitHub
parent fc0e3fe663
commit cbf5b725d9

View File

@@ -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