package migrations import ( "encoding/json" "github.com/pocketbase/pocketbase/core" m "github.com/pocketbase/pocketbase/migrations" ) func init() { m.Register(func(app core.App) error { collection, err := app.FindCollectionByNameOrId("dd2l9a4vxpy2ni8") if err != nil { return err } // update collection data if err := json.Unmarshal([]byte(`{ "indexes": [ "CREATE UNIQUE INDEX `+"`"+`idx_iSbmEqYXbV`+"`"+` ON `+"`"+`summit_logs`+"`"+` (`+"`"+`iri`+"`"+`) WHERE iri IS NOT NULL AND iri != \"\";" ] }`), &collection); err != nil { return err } return app.Save(collection) }, func(app core.App) error { collection, err := app.FindCollectionByNameOrId("dd2l9a4vxpy2ni8") if err != nil { return err } // update collection data if err := json.Unmarshal([]byte(`{ "indexes": [] }`), &collection); err != nil { return err } return app.Save(collection) }) }