mirror of
https://github.com/usual2970/certimate.git
synced 2025-09-09 09:51:46 +00:00
.github
.vscode
docker
internal
migrations
1724677539_update_admin.go
1726147254_collections_snapshot.go
1726147268_update_access_usage.go
1726184067_collections_snapshot.go
1726299230_collections_snapshot.go
1729671262_collections_snapshot.go
1730766480_collections_snapshot.go
1731463526_updated_access.go
1731872250_add_byteplus.go
1732450576_collections_snapshot.go
1734398918_updated_access.go
1734434522_updated_access.go
1734868882_updated_access.go
1734869127_updated_domains.go
1734869146_updated_deployments.go
1734869175_updated_domains.go
1734869180_deleted_domains.go
1734869185_deleted_deployments.go
1734869190_deleted_access_groups.go
1735032595_add_namedotcom.go
1735151867_updated_access.go
1735913237_updated_access.go
1735966817_updated_workflow.go
1735976342_updated_certificate.go
1735977005_updated_workflow_output.go
1735977021_updated_workflow_run_log.go
1735977530_updated_certificate.go
1735980691_updated_workflow_run_log.go
1735981441_updated_workflow.go
1735981515_updated_workflow_run.go
ui
.dockerignore
.editorconfig
.gitignore
.goreleaser.yml
CHANGELOG.md
CONTRIBUTING.md
CONTRIBUTING_EN.md
Dockerfile
LICENSE.md
Makefile
README.md
README_EN.md
go.mod
go.sum
main.go
nixpacks.toml
usage.gif
107 lines
2.1 KiB
Go
107 lines
2.1 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("tovyif5ax6j62ur")
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
// add
|
|
new_lastRunId := &schema.SchemaField{}
|
|
if err := json.Unmarshal([]byte(`{
|
|
"system": false,
|
|
"id": "a23wkj9x",
|
|
"name": "lastRunId",
|
|
"type": "relation",
|
|
"required": false,
|
|
"presentable": false,
|
|
"unique": false,
|
|
"options": {
|
|
"collectionId": "qjp8lygssgwyqyz",
|
|
"cascadeDelete": false,
|
|
"minSelect": null,
|
|
"maxSelect": 1,
|
|
"displayFields": null
|
|
}
|
|
}`), new_lastRunId); err != nil {
|
|
return err
|
|
}
|
|
collection.Schema.AddField(new_lastRunId)
|
|
|
|
// add
|
|
new_lastRunStatus := &schema.SchemaField{}
|
|
if err := json.Unmarshal([]byte(`{
|
|
"system": false,
|
|
"id": "zivdxh23",
|
|
"name": "lastRunStatus",
|
|
"type": "select",
|
|
"required": false,
|
|
"presentable": false,
|
|
"unique": false,
|
|
"options": {
|
|
"maxSelect": 1,
|
|
"values": [
|
|
"pending",
|
|
"running",
|
|
"succeeded",
|
|
"failed"
|
|
]
|
|
}
|
|
}`), new_lastRunStatus); err != nil {
|
|
return err
|
|
}
|
|
collection.Schema.AddField(new_lastRunStatus)
|
|
|
|
// add
|
|
new_lastRunTime := &schema.SchemaField{}
|
|
if err := json.Unmarshal([]byte(`{
|
|
"system": false,
|
|
"id": "u9bosu36",
|
|
"name": "lastRunTime",
|
|
"type": "date",
|
|
"required": false,
|
|
"presentable": false,
|
|
"unique": false,
|
|
"options": {
|
|
"min": "",
|
|
"max": ""
|
|
}
|
|
}`), new_lastRunTime); err != nil {
|
|
return err
|
|
}
|
|
collection.Schema.AddField(new_lastRunTime)
|
|
|
|
return dao.SaveCollection(collection)
|
|
}, func(db dbx.Builder) error {
|
|
dao := daos.New(db);
|
|
|
|
collection, err := dao.FindCollectionByNameOrId("tovyif5ax6j62ur")
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
// remove
|
|
collection.Schema.RemoveField("a23wkj9x")
|
|
|
|
// remove
|
|
collection.Schema.RemoveField("zivdxh23")
|
|
|
|
// remove
|
|
collection.Schema.RemoveField("u9bosu36")
|
|
|
|
return dao.SaveCollection(collection)
|
|
})
|
|
}
|