From ee4332bd81fd06776b0447ea4b71822d424bdda2 Mon Sep 17 00:00:00 2001 From: Arzumify Date: Mon, 6 May 2024 00:50:05 +0100 Subject: [PATCH] Re-add vaccum --- vaccum | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 vaccum diff --git a/vaccum b/vaccum new file mode 100644 index 0000000..53dfa11 --- /dev/null +++ b/vaccum @@ -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("[INFO] Vacuuming...") + conn = get_db_connection() + conn.execute("VACUUM") + conn.commit() + conn.close() + print("[INFO] Success") +else: + print("[ERROR] Database not found")