conflict name change

This commit is contained in:
arcbtc 2023-12-28 14:24:22 +00:00
parent 5ca331134c
commit e8370579fb
2 changed files with 7 additions and 7 deletions

10
crud.py
View file

@ -11,7 +11,7 @@ async def create_temp(wallet_id: str, data: CreateTempData) -> Temp:
temp_id = urlsafe_short_hash() temp_id = urlsafe_short_hash()
await db.execute( await db.execute(
""" """
INSERT INTO temp.temp (id, wallet, name, total) INSERT INTO tempextension.tempextension (id, wallet, name, total)
VALUES (?, ?, ?, ?) VALUES (?, ?, ?, ?)
""", """,
( (
@ -29,7 +29,7 @@ async def create_temp(wallet_id: str, data: CreateTempData) -> Temp:
async def get_temp(temp_id: str) -> Optional[Temp]: async def get_temp(temp_id: str) -> Optional[Temp]:
row = await db.fetchone("SELECT * FROM temp.temp WHERE id = ?", (temp_id,)) row = await db.fetchone("SELECT * FROM tempextension.tempextension WHERE id = ?", (temp_id,))
return Temp(**row) if row else None return Temp(**row) if row else None
async def get_temps(wallet_ids: Union[str, List[str]]) -> List[Temp]: async def get_temps(wallet_ids: Union[str, List[str]]) -> List[Temp]:
@ -38,18 +38,18 @@ async def get_temps(wallet_ids: Union[str, List[str]]) -> List[Temp]:
q = ",".join(["?"] * len(wallet_ids)) q = ",".join(["?"] * len(wallet_ids))
rows = await db.fetchall( rows = await db.fetchall(
f"SELECT * FROM temp.temp WHERE wallet IN ({q})", (*wallet_ids,) f"SELECT * FROM tempextension.tempextension WHERE wallet IN ({q})", (*wallet_ids,)
) )
return [Temp(**row) for row in rows] return [Temp(**row) for row in rows]
async def update_temp(temp_id: str, **kwargs) -> Temp: async def update_temp(temp_id: str, **kwargs) -> Temp:
q = ", ".join([f"{field[0]} = ?" for field in kwargs.items()]) q = ", ".join([f"{field[0]} = ?" for field in kwargs.items()])
await db.execute( await db.execute(
f"UPDATE temp.temp SET {q} WHERE id = ?", (*kwargs.values(), temp_id) f"UPDATE tempextension.tempextension SET {q} WHERE id = ?", (*kwargs.values(), temp_id)
) )
temp = await get_temp(temp_id) temp = await get_temp(temp_id)
assert temp, "Newly updated temp couldn't be retrieved" assert temp, "Newly updated temp couldn't be retrieved"
return temp return temp
async def delete_temp(temp_id: str) -> None: async def delete_temp(temp_id: str) -> None:
await db.execute("DELETE FROM temp.temp WHERE id = ?", (temp_id,)) await db.execute("DELETE FROM tempextension.tempextension WHERE id = ?", (temp_id,))

View file

@ -6,7 +6,7 @@ async def m001_initial(db):
""" """
await db.execute( await db.execute(
""" """
CREATE TABLE temp.temp ( CREATE TABLE tempextension.tempextension (
id TEXT PRIMARY KEY, id TEXT PRIMARY KEY,
wallet TEXT NOT NULL, wallet TEXT NOT NULL,
name TEXT NOT NULL, name TEXT NOT NULL,
@ -24,6 +24,6 @@ async def m002_addtip_wallet(db):
""" """
await db.execute( await db.execute(
""" """
ALTER TABLE temp.temp ADD lnurlwithdrawamount INTEGER DEFAULT 0; ALTER TABLE tempextension.tempextension ADD lnurlwithdrawamount INTEGER DEFAULT 0;
""" """
) )