1 package migrations
2 3 import (
4 _ "embed"
5 6 "github.com/go-gormigrate/gormigrate/v2"
7 "gorm.io/gorm"
8 )
9 10 // VACUUM to finish the update the vacuum mode to auto_vacuum
11 // See https://sqlite.org/pragma.html
12 // "The database connection can be changed between full and incremental autovacuum mode at any time.
13 // However, changing from "none" to "full" or "incremental" can only occur when the database is new
14 // (no tables have yet been created) or by running the VACUUM command."
15 var _202406071726_vacuum = &gormigrate.Migration{
16 ID: "202406071726_vacuum",
17 Migrate: func(tx *gorm.DB) error {
18 // Disabled for now: not used.
19 // Cannot run when testing with txdb: VACUUM must be run outside of transaction.
20 // if !testing.Testing() {
21 // if err := tx.Exec("VACUUM").Error; err != nil {
22 // return err
23 // }
24 // }
25 26 return nil
27 },
28 Rollback: func(tx *gorm.DB) error {
29 return nil
30 },
31 }
32