package migrations import ( "encoding/json" "github.com/pocketbase/dbx" "github.com/pocketbase/pocketbase/daos" m "github.com/pocketbase/pocketbase/migrations" "github.com/pocketbase/pocketbase/models/schema" ) func init() { m.Register(func(db dbx.Builder) error { dao := daos.New(db); collection, err := dao.FindCollectionByNameOrId("no89qd9ku8qo11e") if err != nil { return err } // add new_blockchain_address := &schema.SchemaField{} json.Unmarshal([]byte(`{ "system": false, "id": "hlbyntap", "name": "blockchain_address", "type": "text", "required": true, "presentable": false, "unique": false, "options": { "min": null, "max": null, "pattern": "" } }`), new_blockchain_address) collection.Schema.AddField(new_blockchain_address) return dao.SaveCollection(collection) }, func(db dbx.Builder) error { dao := daos.New(db); collection, err := dao.FindCollectionByNameOrId("no89qd9ku8qo11e") if err != nil { return err } // remove collection.Schema.RemoveField("hlbyntap") return dao.SaveCollection(collection) }) }