mirror of
https://github.com/grassrootseconomics/farmstar-survey-backend.git
synced 2024-11-16 07:16:47 +01:00
94 lines
1.8 KiB
Go
94 lines
1.8 KiB
Go
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_evergrow_crops := &schema.SchemaField{}
|
|
json.Unmarshal([]byte(`{
|
|
"system": false,
|
|
"id": "5kxslfpx",
|
|
"name": "evergrow_crops",
|
|
"type": "select",
|
|
"required": false,
|
|
"presentable": false,
|
|
"unique": false,
|
|
"options": {
|
|
"maxSelect": 12,
|
|
"values": [
|
|
"rice",
|
|
"coffee",
|
|
"tea",
|
|
"sugarcane",
|
|
"miraa",
|
|
"avocados",
|
|
"maize",
|
|
"potatoes",
|
|
"sorghum",
|
|
"other_fruits",
|
|
"other_vegetables",
|
|
"other_grains",
|
|
"dragonfruit"
|
|
]
|
|
}
|
|
}`), edit_evergrow_crops)
|
|
collection.Schema.AddField(edit_evergrow_crops)
|
|
|
|
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_evergrow_crops := &schema.SchemaField{}
|
|
json.Unmarshal([]byte(`{
|
|
"system": false,
|
|
"id": "5kxslfpx",
|
|
"name": "evergrow_crops",
|
|
"type": "select",
|
|
"required": false,
|
|
"presentable": false,
|
|
"unique": false,
|
|
"options": {
|
|
"maxSelect": 12,
|
|
"values": [
|
|
"rice",
|
|
"coffee",
|
|
"tea",
|
|
"sugarcane",
|
|
"miraa",
|
|
"avocados",
|
|
"maize",
|
|
"potatoes",
|
|
"sorghum",
|
|
"other_fruits",
|
|
"other_vegetables",
|
|
"other_grains"
|
|
]
|
|
}
|
|
}`), edit_evergrow_crops)
|
|
collection.Schema.AddField(edit_evergrow_crops)
|
|
|
|
return dao.SaveCollection(collection)
|
|
})
|
|
}
|