From e53ccb04accc9d53f65e69468b9c84343c45e73c Mon Sep 17 00:00:00 2001 From: ben Date: Tue, 24 Jan 2023 12:45:15 +0000 Subject: [PATCH] Added timestamp and endless For future culling of links. If endless is not specified, then links older than x could be removed --- lnbits/core/migrations.py | 6 ++++-- lnbits/core/models.py | 2 ++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/lnbits/core/migrations.py b/lnbits/core/migrations.py index d7e0e186d..499adad6b 100644 --- a/lnbits/core/migrations.py +++ b/lnbits/core/migrations.py @@ -273,10 +273,12 @@ async def m008_create_admin_settings_table(db): async def m009_create_tinyurl_table(db): await db.execute( - """ + f""" CREATE TABLE IF NOT EXISTS tiny_url ( id TEXT PRIMARY KEY, - url TEXT + url TEXT, + endless BOOL NOT NULL DEFAULT false, + time TIMESTAMP NOT NULL DEFAULT {db.timestamp_now}, ); """ ) diff --git a/lnbits/core/models.py b/lnbits/core/models.py index 4b5094961..19e597769 100644 --- a/lnbits/core/models.py +++ b/lnbits/core/models.py @@ -218,6 +218,8 @@ class BalanceCheck(BaseModel): class TinyURL(BaseModel): id: str url: str + endless: bool + time: float @classmethod def from_row(cls, row: Row):