enabled sqlite3 auto_vacuum
This commit is contained in:
parent
0f2b213406
commit
ccb53c85c6
3
db.go
3
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{})
|
||||
|
||||
|
|
Loading…
Reference in New Issue