mirror of
https://github.com/usual2970/certimate.git
synced 2025-10-04 21:44:54 +00:00
build: rebuilld pocketbase migration snapshot
This commit is contained in:
27
migrations/1737141502_superusers_initial.go
Normal file
27
migrations/1737141502_superusers_initial.go
Normal file
@@ -0,0 +1,27 @@
|
||||
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)
|
||||
record.Set("email", "admin@certimate.fun")
|
||||
record.Set("password", "1234567890")
|
||||
return app.Save(record)
|
||||
}, func(app core.App) error {
|
||||
record, _ := app.FindAuthRecordByEmail(core.CollectionNameSuperusers, "admin@certimate.fun")
|
||||
if record == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
return app.Delete(record)
|
||||
})
|
||||
}
|
Reference in New Issue
Block a user