diff --git a/services/data-manager/migrations/1687801090_initial_superuser.go b/services/data-manager/migrations/1687801090_initial_superuser.go new file mode 100644 index 0000000..5f8541c --- /dev/null +++ b/services/data-manager/migrations/1687801090_initial_superuser.go @@ -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) + }) +} diff --git a/services/data-manager/migrations/1745155564_collections_snapshot.go b/services/data-manager/migrations/1745249435_collections_snapshot.go similarity index 99% rename from services/data-manager/migrations/1745155564_collections_snapshot.go rename to services/data-manager/migrations/1745249435_collections_snapshot.go index 4acc379..1b8214e 100644 --- a/services/data-manager/migrations/1745155564_collections_snapshot.go +++ b/services/data-manager/migrations/1745249435_collections_snapshot.go @@ -653,7 +653,7 @@ func init() { }, "name": "users", "oauth2": { - "enabled": true, + "enabled": false, "mappedFields": { "avatarURL": "", "id": "",