From ccb53c85c6ce86e2962da51e2d0ba872074c1398 Mon Sep 17 00:00:00 2001 From: Steve White Date: Thu, 17 Oct 2024 10:07:12 -0500 Subject: [PATCH] enabled sqlite3 auto_vacuum --- db.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/db.go b/db.go index fbe1da3..e75ac89 100644 --- a/db.go +++ b/db.go @@ -36,6 +36,9 @@ func ConnectDB(dbPath string) (*gorm.DB, error) { return nil, fmt.Errorf("failed to connect to database: %v", err) } + // set auto_vacuum mode to ON + // this automagically removes old rows from the database when idle + db.Exec("PRAGMA auto_vacuum = ON;") // AutoMigrate will create the tables if they don't exist db.AutoMigrate(&Box{}, &Item{}, &User{})