updates migrations

This commit is contained in:
Christian Beutel
2025-03-17 00:03:56 +01:00
parent c765e6391d
commit eca79758ec
130 changed files with 2107 additions and 2758 deletions

View File

@@ -3,23 +3,20 @@ package migrations
import (
"encoding/json"
"github.com/pocketbase/dbx"
"github.com/pocketbase/pocketbase/daos"
"github.com/pocketbase/pocketbase/core"
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);
m.Register(func(app core.App) error {
collection, err := dao.FindCollectionByNameOrId("lf06qip3f4d11yk")
collection, err := app.FindCollectionByNameOrId("lf06qip3f4d11yk")
if err != nil {
return err
}
// update
edit_author := &schema.SchemaField{}
edit_author := &core.RelationField{}
if err := json.Unmarshal([]byte(`{
"system": false,
"id": "7lwo1mxx",
@@ -38,19 +35,18 @@ func init() {
}`), edit_author); err != nil {
return err
}
collection.Schema.AddField(edit_author)
collection.Fields.Add(edit_author)
return dao.SaveCollection(collection)
}, func(db dbx.Builder) error {
dao := daos.New(db);
return app.Save(collection)
}, func(app core.App) error {
collection, err := dao.FindCollectionByNameOrId("lf06qip3f4d11yk")
collection, err := app.FindCollectionByNameOrId("lf06qip3f4d11yk")
if err != nil {
return err
}
// update
edit_author := &schema.SchemaField{}
edit_author := &core.RelationField{}
if err := json.Unmarshal([]byte(`{
"system": false,
"id": "7lwo1mxx",
@@ -69,8 +65,8 @@ func init() {
}`), edit_author); err != nil {
return err
}
collection.Schema.AddField(edit_author)
collection.Fields.Add(edit_author)
return dao.SaveCollection(collection)
return app.Save(collection)
})
}