Added timestamp and endless

For future culling of links. If endless is not specified, then links older than x could be removed
This commit is contained in:
ben 2023-01-24 12:45:15 +00:00
parent 0d0817044c
commit e53ccb04ac
2 changed files with 6 additions and 2 deletions

View File

@ -273,10 +273,12 @@ async def m008_create_admin_settings_table(db):
async def m009_create_tinyurl_table(db): async def m009_create_tinyurl_table(db):
await db.execute( await db.execute(
""" f"""
CREATE TABLE IF NOT EXISTS tiny_url ( CREATE TABLE IF NOT EXISTS tiny_url (
id TEXT PRIMARY KEY, id TEXT PRIMARY KEY,
url TEXT url TEXT,
endless BOOL NOT NULL DEFAULT false,
time TIMESTAMP NOT NULL DEFAULT {db.timestamp_now},
); );
""" """
) )

View File

@ -218,6 +218,8 @@ class BalanceCheck(BaseModel):
class TinyURL(BaseModel): class TinyURL(BaseModel):
id: str id: str
url: str url: str
endless: bool
time: float
@classmethod @classmethod
def from_row(cls, row: Row): def from_row(cls, row: Row):