* initial commit * persist meili token in cookie * handle login/logout cookie invalidation * fix review suggestions --------- Co-authored-by: Christian Beutel <>
46 lines
907 B
Go
46 lines
907 B
Go
package migrations
|
|
|
|
import (
|
|
"github.com/pocketbase/pocketbase/core"
|
|
m "github.com/pocketbase/pocketbase/migrations"
|
|
)
|
|
|
|
func init() {
|
|
m.Register(func(app core.App) error {
|
|
collection, err := app.FindCollectionByNameOrId("_pb_users_auth_")
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
// remove field
|
|
collection.Fields.RemoveById("dlzhxcn2")
|
|
|
|
return app.Save(collection)
|
|
}, func(app core.App) error {
|
|
collection, err := app.FindCollectionByNameOrId("_pb_users_auth_")
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
// add field
|
|
if err := collection.Fields.AddMarshaledJSONAt(7, []byte(`{
|
|
"autogeneratePattern": "",
|
|
"hidden": false,
|
|
"id": "dlzhxcn2",
|
|
"max": 0,
|
|
"min": 0,
|
|
"name": "token",
|
|
"pattern": "",
|
|
"presentable": false,
|
|
"primaryKey": false,
|
|
"required": false,
|
|
"system": false,
|
|
"type": "text"
|
|
}`)); err != nil {
|
|
return err
|
|
}
|
|
|
|
return app.Save(collection)
|
|
})
|
|
}
|