关闭外键,增加路由

This commit is contained in:
xmdhs 2023-09-04 16:12:05 +08:00
parent cf49d29e5a
commit 72f051380c
No known key found for this signature in database
GPG Key ID: E809D6D43DEFCC95
2 changed files with 3 additions and 1 deletions

View File

@ -15,6 +15,7 @@ import (
"github.com/xmdhs/authlib-skin/config"
"github.com/xmdhs/authlib-skin/db/cache"
"github.com/xmdhs/authlib-skin/db/ent"
"github.com/xmdhs/authlib-skin/db/ent/migrate"
)
func ProvideSlog(c config.Config) slog.Handler {
@ -62,7 +63,7 @@ func ProvideEnt(ctx context.Context, db *sql.DB, c config.Config, sl *slog.Logge
opts = append(opts, ent.Debug())
}
e := ent.NewClient(opts...)
err := e.Schema.Create(ctx)
err := e.Schema.Create(ctx, migrate.WithForeignKeys(false), migrate.WithDropIndex(true), migrate.WithDropColumn(true))
if err != nil {
return nil, nil, fmt.Errorf("ProvideEnt: %w", err)
}

View File

@ -23,6 +23,7 @@ func NewRoute(yggService *yggdrasil.Yggdrasil, handel *handle.Handel) (*httprout
func newYggdrasil(r *httprouter.Router, handelY yggdrasil.Yggdrasil) error {
r.POST("/api/authserver/authenticate", warpHJSON(handelY.Authenticate()))
r.POST("/api/authserver/validate", warpHJSON(handelY.Validate()))
return nil
}