feat: add NCPB option to farmers survey

This commit is contained in:
Mohamed Sohail 2024-03-18 13:24:00 +08:00
parent 2ee353aae8
commit 780c38e341
Signed by: kamikazechaser
GPG Key ID: 7DD45520C01CD85D

View File

@ -0,0 +1,79 @@
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("4f0a5b2wec6okxi")
if err != nil {
return err
}
// update
edit_purchase_channels := &schema.SchemaField{}
json.Unmarshal([]byte(`{
"system": false,
"id": "fl4s3aca",
"name": "purchase_channels",
"type": "select",
"required": true,
"presentable": false,
"unique": false,
"options": {
"maxSelect": 5,
"values": [
"manufacturers",
"distributors",
"resellers",
"farmers",
"other",
"ncpb"
]
}
}`), edit_purchase_channels)
collection.Schema.AddField(edit_purchase_channels)
return dao.SaveCollection(collection)
}, func(db dbx.Builder) error {
dao := daos.New(db);
collection, err := dao.FindCollectionByNameOrId("4f0a5b2wec6okxi")
if err != nil {
return err
}
// update
edit_purchase_channels := &schema.SchemaField{}
json.Unmarshal([]byte(`{
"system": false,
"id": "fl4s3aca",
"name": "purchase_channels",
"type": "select",
"required": true,
"presentable": false,
"unique": false,
"options": {
"maxSelect": 5,
"values": [
"manufacturers",
"distributors",
"resellers",
"farmers",
"other"
]
}
}`), edit_purchase_channels)
collection.Schema.AddField(edit_purchase_channels)
return dao.SaveCollection(collection)
})
}