add vacuum

This commit is contained in:
maaa 2023-08-02 21:23:36 +02:00
parent ae5e4bc9f4
commit 5a353b3ece
1 changed files with 18 additions and 0 deletions

18
vacuum Normal file
View File

@ -0,0 +1,18 @@
#!/usr/bin/python3
import sqlite3
import os
def get_db_connection():
conn = sqlite3.connect("database.db")
conn.row_factory = sqlite3.Row
return conn
if os.path.exists("database.db"):
print("vacuuming..")
conn = get_db_connection()
conn.execute("VACUUM")
conn.commit()
conn.close()
print("success")
else:
print("database not found")