Skip to content

Commit 8078cdc

Browse files
authored
fix: log version & migration count (#1934)
1 parent 21c2256 commit 8078cdc

File tree

3 files changed

+7
-3
lines changed

3 files changed

+7
-3
lines changed

cmd/migrate_cmd.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -99,11 +99,11 @@ func migrate(cmd *cobra.Command, args []string) {
9999
// turn off schema dump
100100
mig.SchemaPath = ""
101101

102-
err = mig.Up()
102+
count, err := mig.UpTo(0)
103103
if err != nil {
104104
log.Fatalf("%v", errors.Wrap(err, "running db migrations"))
105105
} else {
106-
log.Infof("GoTrue migrations applied successfully")
106+
log.WithField("count", count).Infof("GoTrue migrations applied successfully")
107107
}
108108

109109
log.Debugf("after status")

cmd/serve_cmd.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -46,13 +46,13 @@ func serve(ctx context.Context) {
4646
defer db.Close()
4747

4848
addr := net.JoinHostPort(config.API.Host, config.API.Port)
49-
logrus.Infof("GoTrue API started on: %s", addr)
5049

5150
opts := []api.Option{
5251
api.NewLimiterOptions(config),
5352
}
5453
a := api.NewAPIWithVersion(config, db, utilities.Version, opts...)
5554
ah := reloader.NewAtomicHandler(a)
55+
logrus.WithField("version", a.Version()).Infof("GoTrue API started on: %s", addr)
5656

5757
baseCtx, baseCancel := context.WithCancel(context.Background())
5858
defer baseCancel()

internal/api/api.go

+4
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,10 @@ type API struct {
3939
limiterOpts *LimiterOptions
4040
}
4141

42+
func (a *API) Version() string {
43+
return a.version
44+
}
45+
4246
func (a *API) Now() time.Time {
4347
if a.overrideTime != nil {
4448
return a.overrideTime()

0 commit comments

Comments
 (0)