Skip to content

Commit eeca5c5

Browse files
committed
Add Init method
1 parent 7ab207a commit eeca5c5

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

dbump.go

+4
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ const lockNum int64 = 777_777_777
1414

1515
// Migrator represents DB over which we will run migration queries.
1616
type Migrator interface {
17+
Init(ctx context.Context) error
1718
LockDB(ctx context.Context) error
1819
UnlockDB(ctx context.Context) error
1920

@@ -68,6 +69,9 @@ func loadMigrations(ms []*Migration, err error) ([]*Migration, error) {
6869
}
6970

7071
func runMigration(ctx context.Context, m Migrator, ms []*Migration) error {
72+
if err := m.Init(ctx); err != nil {
73+
return fmt.Errorf("init: %w", err)
74+
}
7175
if err := m.LockDB(ctx); err != nil {
7276
return fmt.Errorf("lock db: %w", err)
7377
}

0 commit comments

Comments
 (0)