remove IF NOT EXISTS in CREATE VIEW

This commit is contained in:
Tiago vasconcelos
2021-11-15 21:45:13 +00:00
parent c34041c49c
commit e8882645c4

View File

@@ -64,7 +64,7 @@ async def m001_initial(db):
await db.execute( await db.execute(
""" """
CREATE VIEW IF NOT EXISTS balances AS CREATE VIEW balances AS
SELECT wallet, COALESCE(SUM(s), 0) AS balance FROM ( SELECT wallet, COALESCE(SUM(s), 0) AS balance FROM (
SELECT wallet, SUM(amount) AS s -- incoming SELECT wallet, SUM(amount) AS s -- incoming
FROM apipayments FROM apipayments
@@ -144,7 +144,7 @@ async def m004_ensure_fees_are_always_negative(db):
await db.execute("DROP VIEW balances") await db.execute("DROP VIEW balances")
await db.execute( await db.execute(
""" """
CREATE VIEW IF NOT EXISTS balances AS CREATE VIEW balances AS
SELECT wallet, COALESCE(SUM(s), 0) AS balance FROM ( SELECT wallet, COALESCE(SUM(s), 0) AS balance FROM (
SELECT wallet, SUM(amount) AS s -- incoming SELECT wallet, SUM(amount) AS s -- incoming
FROM apipayments FROM apipayments