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:
Vlad Stan
2023-06-15 16:22:18 +02:00
committed by GitHub
parent 95281eba8c
commit 8c0e7725de
9 changed files with 170 additions and 46 deletions
+15
View File
@@ -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"