fix:#65 updated migration files

This commit is contained in:
Elmar Kresse
2025-04-22 09:43:19 +02:00
parent 6988fcdf2b
commit 198ef20f03
2 changed files with 32 additions and 1 deletions

View File

@ -0,0 +1,31 @@
package migrations
import (
"github.com/pocketbase/pocketbase/core"
m "github.com/pocketbase/pocketbase/migrations"
)
func init() {
m.Register(func(app core.App) error {
superusers, err := app.FindCollectionByNameOrId(core.CollectionNameSuperusers)
if err != nil {
return err
}
record := core.NewRecord(superusers)
// note: the values can be eventually loaded via os.Getenv(key)
// or from a special local config file
record.Set("email", "demo@htwkalender.de")
record.Set("password", "htwkalender-demo")
return app.Save(record)
}, func(app core.App) error { // optional revert operation
record, _ := app.FindAuthRecordByEmail(core.CollectionNameSuperusers, "demo@htwkalender.de")
if record == nil {
return nil // probably already deleted
}
return app.Delete(record)
})
}

View File

@ -653,7 +653,7 @@ func init() {
}, },
"name": "users", "name": "users",
"oauth2": { "oauth2": {
"enabled": true, "enabled": false,
"mappedFields": { "mappedFields": {
"avatarURL": "", "avatarURL": "",
"id": "", "id": "",