mirror of
https://github.com/grassrootseconomics/farmstar-survey-backend.git
synced 2024-12-04 23:46:10 +01:00
feat: add NCPB option to farmers survey
This commit is contained in:
parent
2ee353aae8
commit
780c38e341
79
migrations/1710739378_updated_farmer_evergrow.go
Normal file
79
migrations/1710739378_updated_farmer_evergrow.go
Normal 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)
|
||||
})
|
||||
}
|
Loading…
Reference in New Issue
Block a user