mirror of
https://gitlab.dit.htwk-leipzig.de/htwk-software/htwkalender.git
synced 2026-01-17 20:12:26 +01:00
33 lines
672 B
Go
33 lines
672 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("users")
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
// Enable OAuth2
|
|
collection.OAuth2.Enabled = true
|
|
|
|
// Optional: Map fields if necessary, for now just enabling it
|
|
// collection.OAuth2.MappedFields.Name = "name"
|
|
|
|
return app.Save(collection)
|
|
}, func(app core.App) error {
|
|
collection, err := app.FindCollectionByNameOrId("users")
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
collection.OAuth2.Enabled = false
|
|
|
|
return app.Save(collection)
|
|
})
|
|
}
|