+FTS5 Rebuild

This commit is contained in:
Simon Martens
2026-01-30 16:22:19 +01:00
parent 52fecc0d05
commit 82c3c9c1e3
17 changed files with 1475 additions and 174 deletions

View File

@@ -0,0 +1,36 @@
package migrations
import (
"strings"
"github.com/Theodor-Springmann-Stiftung/musenalm/dbmodels"
"github.com/pocketbase/pocketbase/core"
m "github.com/pocketbase/pocketbase/migrations"
)
func init() {
m.Register(func(app core.App) error {
collection := core.NewBaseCollection(dbmodels.SETTINGS_TABLE)
dbmodels.SetBasicPublicRules(collection)
fields := core.NewFieldsList(
&core.TextField{Name: dbmodels.KEY_FIELD, Required: true, Presentable: true},
&core.JSONField{Name: dbmodels.VALUE_FIELD, Required: false},
)
dbmodels.SetCreatedUpdatedFields(&fields)
collection.Fields = fields
dbmodels.AddIndex(collection, dbmodels.KEY_FIELD, true)
return app.Save(collection)
}, func(app core.App) error {
collection, err := app.FindCollectionByNameOrId(dbmodels.SETTINGS_TABLE)
if err != nil {
if strings.Contains(err.Error(), "not found") || strings.Contains(err.Error(), "no rows in result set") {
return nil
}
app.Logger().Error("Failed to find collection for deletion", "collection", dbmodels.SETTINGS_TABLE, "error", err)
return err
}
return app.Delete(collection)
})
}