From 2ee353aae85e3e303874a985479d6b47859a1e74 Mon Sep 17 00:00:00 2001 From: Mohammed Sohail Date: Wed, 21 Feb 2024 20:51:39 +0300 Subject: [PATCH] feat: add dragon fruit crop --- .../1708537765_updated_farmer_evergrow.go | 93 +++++++++++++++++++ migrations/1708537801_updated_farmer_farm.go | 93 +++++++++++++++++++ ...537811_updated_farmer_other_fertilizers.go | 93 +++++++++++++++++++ .../1708537833_updated_farmer_past_harvest.go | 93 +++++++++++++++++++ 4 files changed, 372 insertions(+) create mode 100644 migrations/1708537765_updated_farmer_evergrow.go create mode 100644 migrations/1708537801_updated_farmer_farm.go create mode 100644 migrations/1708537811_updated_farmer_other_fertilizers.go create mode 100644 migrations/1708537833_updated_farmer_past_harvest.go diff --git a/migrations/1708537765_updated_farmer_evergrow.go b/migrations/1708537765_updated_farmer_evergrow.go new file mode 100644 index 0000000..4d232ea --- /dev/null +++ b/migrations/1708537765_updated_farmer_evergrow.go @@ -0,0 +1,93 @@ +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) + }) +} diff --git a/migrations/1708537801_updated_farmer_farm.go b/migrations/1708537801_updated_farmer_farm.go new file mode 100644 index 0000000..d47d23b --- /dev/null +++ b/migrations/1708537801_updated_farmer_farm.go @@ -0,0 +1,93 @@ +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("uutt9wj7d5ejmhz") + if err != nil { + return err + } + + // update + edit_planned_crops := &schema.SchemaField{} + json.Unmarshal([]byte(`{ + "system": false, + "id": "p4n5v8yf", + "name": "planned_crops", + "type": "select", + "required": true, + "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_planned_crops) + collection.Schema.AddField(edit_planned_crops) + + return dao.SaveCollection(collection) + }, func(db dbx.Builder) error { + dao := daos.New(db); + + collection, err := dao.FindCollectionByNameOrId("uutt9wj7d5ejmhz") + if err != nil { + return err + } + + // update + edit_planned_crops := &schema.SchemaField{} + json.Unmarshal([]byte(`{ + "system": false, + "id": "p4n5v8yf", + "name": "planned_crops", + "type": "select", + "required": true, + "presentable": false, + "unique": false, + "options": { + "maxSelect": 12, + "values": [ + "rice", + "coffee", + "tea", + "sugarcane", + "miraa", + "avocados", + "maize", + "potatoes", + "sorghum", + "other_fruits", + "other_vegetables", + "other_grains" + ] + } + }`), edit_planned_crops) + collection.Schema.AddField(edit_planned_crops) + + return dao.SaveCollection(collection) + }) +} diff --git a/migrations/1708537811_updated_farmer_other_fertilizers.go b/migrations/1708537811_updated_farmer_other_fertilizers.go new file mode 100644 index 0000000..02665e8 --- /dev/null +++ b/migrations/1708537811_updated_farmer_other_fertilizers.go @@ -0,0 +1,93 @@ +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("o7i7dkfc0x2bw22") + if err != nil { + return err + } + + // update + edit_crops := &schema.SchemaField{} + json.Unmarshal([]byte(`{ + "system": false, + "id": "ltb2rowr", + "name": "crops", + "type": "select", + "required": true, + "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_crops) + collection.Schema.AddField(edit_crops) + + return dao.SaveCollection(collection) + }, func(db dbx.Builder) error { + dao := daos.New(db); + + collection, err := dao.FindCollectionByNameOrId("o7i7dkfc0x2bw22") + if err != nil { + return err + } + + // update + edit_crops := &schema.SchemaField{} + json.Unmarshal([]byte(`{ + "system": false, + "id": "ltb2rowr", + "name": "crops", + "type": "select", + "required": true, + "presentable": false, + "unique": false, + "options": { + "maxSelect": 12, + "values": [ + "rice", + "coffee", + "tea", + "sugarcane", + "miraa", + "avocados", + "maize", + "potatoes", + "sorghum", + "other_fruits", + "other_vegetables", + "other_grains" + ] + } + }`), edit_crops) + collection.Schema.AddField(edit_crops) + + return dao.SaveCollection(collection) + }) +} diff --git a/migrations/1708537833_updated_farmer_past_harvest.go b/migrations/1708537833_updated_farmer_past_harvest.go new file mode 100644 index 0000000..39b3a69 --- /dev/null +++ b/migrations/1708537833_updated_farmer_past_harvest.go @@ -0,0 +1,93 @@ +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("5pbnsptw25ip6b1") + if err != nil { + return err + } + + // update + edit_crop := &schema.SchemaField{} + json.Unmarshal([]byte(`{ + "system": false, + "id": "gt06xc9v", + "name": "crop", + "type": "select", + "required": true, + "presentable": false, + "unique": false, + "options": { + "maxSelect": 1, + "values": [ + "rice", + "coffee", + "tea", + "sugarcane", + "miraa", + "avocados", + "maize", + "potatoes", + "sorghum", + "other_fruits", + "other_vegetables", + "other_grains", + "dragonfruit" + ] + } + }`), edit_crop) + collection.Schema.AddField(edit_crop) + + return dao.SaveCollection(collection) + }, func(db dbx.Builder) error { + dao := daos.New(db); + + collection, err := dao.FindCollectionByNameOrId("5pbnsptw25ip6b1") + if err != nil { + return err + } + + // update + edit_crop := &schema.SchemaField{} + json.Unmarshal([]byte(`{ + "system": false, + "id": "gt06xc9v", + "name": "crop", + "type": "select", + "required": true, + "presentable": false, + "unique": false, + "options": { + "maxSelect": 1, + "values": [ + "rice", + "coffee", + "tea", + "sugarcane", + "miraa", + "avocados", + "maize", + "potatoes", + "sorghum", + "other_fruits", + "other_vegetables", + "other_grains" + ] + } + }`), edit_crop) + collection.Schema.AddField(edit_crop) + + return dao.SaveCollection(collection) + }) +}