fix: account insert
This commit is contained in:
+2
-3
@@ -1,5 +1,4 @@
|
||||
import json
|
||||
from datetime import datetime
|
||||
from time import time
|
||||
from typing import Literal, Optional, Union
|
||||
from uuid import uuid4
|
||||
@@ -40,14 +39,14 @@ async def create_account(
|
||||
conn: Optional[Connection] = None,
|
||||
) -> Account:
|
||||
if not account:
|
||||
now = datetime.now()
|
||||
now = int(time())
|
||||
account = Account(id=uuid4().hex, created_at=now, updated_at=now)
|
||||
await (conn or db).insert("accounts", account)
|
||||
return account
|
||||
|
||||
|
||||
async def update_account(account: Account) -> Account:
|
||||
account.updated_at = datetime.now()
|
||||
account.updated_at = int(time())
|
||||
await db.update("accounts", account)
|
||||
return account
|
||||
|
||||
|
||||
@@ -565,13 +565,3 @@ async def m023_add_column_column_to_apipayments(db):
|
||||
|
||||
async def m024_drop_pending(db):
|
||||
await db.execute("ALTER TABLE apipayments DROP COLUMN pending")
|
||||
|
||||
|
||||
async def m025_add_pubkey_to_accounts(db):
|
||||
"""
|
||||
Adds pubkey column to accounts.
|
||||
"""
|
||||
try:
|
||||
await db.execute("ALTER TABLE accounts ADD COLUMN pubkey TEXT")
|
||||
except OperationalError:
|
||||
pass
|
||||
|
||||
Reference in New Issue
Block a user