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,14 +3,12 @@ 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"
)
func init() {
m.Register(func(db dbx.Builder) error {
m.Register(func(app core.App) error {
jsonData := `{
"id": "lf06qip3f4d11yk",
"created": "2024-04-03 18:44:47.201Z",
@@ -73,20 +71,19 @@ func init() {
"options": {}
}`
collection := &models.Collection{}
collection := &core.Collection{}
if err := json.Unmarshal([]byte(jsonData), &collection); err != nil {
return err
}
return daos.New(db).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
}
return dao.DeleteCollection(collection)
return app.Delete(collection)
})
}