This commit is contained in:
henrygd
2026-04-19 19:12:04 -04:00
parent 40da2b4358
commit ea19ef6334
13 changed files with 676 additions and 242 deletions

View File

@@ -0,0 +1,62 @@
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("np_probes_001")
if err != nil {
return err
}
// add field
if err := collection.Fields.AddMarshaledJSONAt(7, []byte(`{
"hidden": false,
"id": "number926446584",
"max": null,
"min": null,
"name": "latency",
"onlyInt": false,
"presentable": false,
"required": false,
"system": false,
"type": "number"
}`)); err != nil {
return err
}
// add field
if err := collection.Fields.AddMarshaledJSONAt(8, []byte(`{
"hidden": false,
"id": "number3726709001",
"max": null,
"min": null,
"name": "loss",
"onlyInt": false,
"presentable": false,
"required": false,
"system": false,
"type": "number"
}`)); err != nil {
return err
}
return app.Save(collection)
}, func(app core.App) error {
collection, err := app.FindCollectionByNameOrId("np_probes_001")
if err != nil {
return err
}
// remove field
collection.Fields.RemoveById("number926446584")
// remove field
collection.Fields.RemoveById("number3726709001")
return app.Save(collection)
})
}