mirror of
https://github.com/seriousm4x/UpSnap.git
synced 2026-03-31 06:24:06 -04:00
46 lines
925 B
Go
46 lines
925 B
Go
package migrations
|
|
|
|
import (
|
|
"github.com/pocketbase/pocketbase/core"
|
|
m "github.com/pocketbase/pocketbase/migrations"
|
|
)
|
|
|
|
func init() {
|
|
m.Register(func(app core.App) error {
|
|
collection, err := app.FindCollectionByNameOrId("z5lghx2r3tm45n1")
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
// add field
|
|
if err := collection.Fields.AddMarshaledJSONAt(5, []byte(`{
|
|
"autogeneratePattern": "",
|
|
"hidden": false,
|
|
"id": "text1843675174",
|
|
"max": 0,
|
|
"min": 0,
|
|
"name": "description",
|
|
"pattern": "",
|
|
"presentable": false,
|
|
"primaryKey": false,
|
|
"required": false,
|
|
"system": false,
|
|
"type": "text"
|
|
}`)); err != nil {
|
|
return err
|
|
}
|
|
|
|
return app.Save(collection)
|
|
}, func(app core.App) error {
|
|
collection, err := app.FindCollectionByNameOrId("z5lghx2r3tm45n1")
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
// remove field
|
|
collection.Fields.RemoveById("text1843675174")
|
|
|
|
return app.Save(collection)
|
|
})
|
|
}
|