Files
.github
.vscode
docker
internal
migrations
1737141501_collections_snapshot.go
1737141502_superusers_initial.go
1738767422_updated_certificate.go
1738828775_updated_workflow.go
1738828788_updated_workflow_run.go
1738839725_updated_certificate.go
1738840633_updated_workflow_output.go
ui
.dockerignore
.editorconfig
.gitignore
.goreleaser.yml
CHANGELOG.md
CONTRIBUTING.md
CONTRIBUTING_EN.md
Dockerfile
LICENSE.md
Makefile
README.md
README_EN.md
go.mod
go.sum
main.go
nixpacks.toml
usage.gif
certimate/migrations/1737141502_superusers_initial.go

28 lines
630 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 {
superusers, err := app.FindCollectionByNameOrId(core.CollectionNameSuperusers)
if err != nil {
return err
}
record, _ := app.FindAuthRecordByEmail(core.CollectionNameSuperusers, "admin@certimate.fun")
if record == nil {
record := core.NewRecord(superusers)
record.Set("email", "admin@certimate.fun")
record.Set("password", "1234567890")
return app.Save(record)
}
return nil
}, func(app core.App) error {
return nil
})
}