Add option to drop extension db at un-install time or later (#1746)
* chore: remove un-used file * feat: allow extension DB clean-up * feat: i18n and bundle update * chore: code format * fix: button color * chore: delete temp file * chore: fix merge conflicts * chore: add extra log * chore: bump CACHE_VERSION to `37`
This commit is contained in:
@@ -303,6 +303,21 @@ class Database(Compat):
|
||||
async def reuse_conn(self, conn: Connection):
|
||||
yield conn
|
||||
|
||||
@classmethod
|
||||
async def clean_ext_db_files(self, ext_id: str) -> bool:
|
||||
"""
|
||||
If the extension DB is stored directly on the filesystem (like SQLite) then delete the files and return True.
|
||||
Otherwise do nothing and return False.
|
||||
"""
|
||||
|
||||
if DB_TYPE == SQLITE:
|
||||
db_file = os.path.join(settings.lnbits_data_folder, f"ext_{ext_id}.sqlite3")
|
||||
if os.path.isfile(db_file):
|
||||
os.remove(db_file)
|
||||
return True
|
||||
|
||||
return False
|
||||
|
||||
|
||||
class Operator(Enum):
|
||||
GT = "gt"
|
||||
|
||||
Reference in New Issue
Block a user