Skip to content

Commit

Permalink
altered syntax
Browse files Browse the repository at this point in the history
  • Loading branch information
trbouma committed Nov 16, 2023
1 parent b519c7d commit f091faf
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions cashu/mint/migrations.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,19 +52,19 @@ async def m002_add_balance_views(db: Database):
await conn.execute(f"""
CREATE VIEW {table_with_schema(db, 'balance_issued')} AS
SELECT COALESCE(SUM(s), 0) AS balance FROM (
SELECT SUM(amount) AS s
SELECT SUM(amount)
FROM {table_with_schema(db, 'promises')}
WHERE amount > 0
);
) AS s;
""")

await conn.execute(f"""
CREATE VIEW {table_with_schema(db, 'balance_redeemed')} AS
SELECT COALESCE(SUM(s), 0) AS balance FROM (
SELECT SUM(amount) AS s
SELECT SUM(amount)
FROM {table_with_schema(db, 'proofs_used')}
WHERE amount > 0
);
) AS s;
""")

await conn.execute(f"""
Expand Down

0 comments on commit f091faf

Please sign in to comment.