diff --git a/README.md b/README.md index d477cf81..435aa517 100644 --- a/README.md +++ b/README.md @@ -27,7 +27,7 @@ Certimate 旨在为用户提供一个安全、简便的 SSL 证书管理解决 默认账号: ```bash -用户名:admin@essay.com +用户名:admin@certimate.fun 密码:1234567890 ``` diff --git a/migrations/1724677539_update_admin.go b/migrations/1724677539_update_admin.go new file mode 100644 index 00000000..fffa4dff --- /dev/null +++ b/migrations/1724677539_update_admin.go @@ -0,0 +1,29 @@ +package migrations + +import ( + "github.com/pocketbase/dbx" + "github.com/pocketbase/pocketbase/daos" + m "github.com/pocketbase/pocketbase/migrations" + "github.com/pocketbase/pocketbase/models" +) + +func init() { + m.Register(func(db dbx.Builder) error { + // add up queries... + dao := daos.New(db) + + admin := &models.Admin{} + admin.Email = "admin@certimate.fun" + admin.SetPassword("1234567890") + return dao.SaveAdmin(admin) + }, func(db dbx.Builder) error { + // add down queries... + dao := daos.New(db) + + admin, _ := dao.FindAdminByEmail("admin@certimate.fun") + if admin != nil { + return dao.DeleteAdmin(admin) + } + return nil + }) +}