Skip to content

Commit 7943a87

Browse files
committed
Log applied migration
Signed-off-by: Bryan Frimin <bryan@getprobo.com>
1 parent 79a1e96 commit 7943a87

1 file changed

Lines changed: 9 additions & 6 deletions

File tree

migrator/migrator.go

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,15 @@ import (
2323
"path"
2424
"sort"
2525

26+
"go.gearno.de/kit/log"
2627
"go.gearno.de/kit/pg"
2728
)
2829

2930
type (
3031
Migrator struct {
31-
pg *pg.Client
32-
disk FS
32+
pg *pg.Client
33+
disk FS
34+
logger *log.Logger
3335
}
3436

3537
Migration struct {
@@ -49,10 +51,11 @@ const (
4951
MigrationAdvisoryLock pg.AdvisoryLock = 0
5052
)
5153

52-
func NewMigrator(pg *pg.Client, disk FS) *Migrator {
54+
func NewMigrator(pg *pg.Client, disk FS, l *log.Logger) *Migrator {
5355
return &Migrator{
54-
pg: pg,
55-
disk: disk,
56+
pg: pg,
57+
disk: disk,
58+
logger: l,
5659
}
5760
}
5861

@@ -92,7 +95,7 @@ func (m *Migrator) Run(ctx context.Context, dirname string) error {
9295
continue
9396
}
9497

95-
// c.logger.Info("applying migration", zap.String("version", migration.Version))
98+
m.logger.Info("applying migration", log.String("version", migration.Version))
9699

97100
err := m.pg.WithTx(
98101
ctx,

0 commit comments

Comments
 (0)