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{})