updates migrations
This commit is contained in:
@@ -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)
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user