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": "iz4sezoehde64wp",
|
||||
"created": "2025-02-02 12:12:48.256Z",
|
||||
@@ -57,20 +55,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("iz4sezoehde64wp")
|
||||
collection, err := app.FindCollectionByNameOrId("iz4sezoehde64wp")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return dao.DeleteCollection(collection)
|
||||
return app.Delete(collection)
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user