adjust copilot to postgres branch.

This commit is contained in:
fiatjaf
2021-07-02 17:36:26 -03:00
parent 46eab3b35e
commit 2466cd59db
2 changed files with 6 additions and 6 deletions

View File

@@ -38,7 +38,7 @@ async def create_copilot(
""" """
INSERT INTO copilots ( INSERT INTO copilots (
id, id,
user, "user",
lnurl_toggle, lnurl_toggle,
wallet, wallet,
title, title,
@@ -101,7 +101,7 @@ async def get_copilot(copilot_id: str) -> Copilots:
async def get_copilots(user: str) -> List[Copilots]: async def get_copilots(user: str) -> List[Copilots]:
rows = await db.fetchall("SELECT * FROM copilots WHERE user = ?", (user,)) rows = await db.fetchall("""SELECT * FROM copilots WHERE "user" = ?""", (user,))
return [Copilots.from_row(row) for row in rows] return [Copilots.from_row(row) for row in rows]

View File

@@ -4,10 +4,10 @@ async def m001_initial(db):
""" """
await db.execute( await db.execute(
""" f"""
CREATE TABLE IF NOT EXISTS copilots ( CREATE TABLE copilot.copilots (
id TEXT NOT NULL PRIMARY KEY, id TEXT NOT NULL PRIMARY KEY,
user TEXT, "user" TEXT,
title TEXT, title TEXT,
lnurl_toggle INTEGER, lnurl_toggle INTEGER,
wallet TEXT, wallet TEXT,
@@ -27,7 +27,7 @@ async def m001_initial(db):
amount_made INTEGER, amount_made INTEGER,
fullscreen_cam INTEGER, fullscreen_cam INTEGER,
iframe_url TEXT, iframe_url TEXT,
timestamp TIMESTAMP NOT NULL DEFAULT (strftime('%s', 'now')) timestamp TIMESTAMP NOT NULL DEFAULT {db.timestamp_now}
); );
""" """
) )