mirror of
https://github.com/uptrace/go-clickhouse.git
synced 2025-06-08 23:26:11 +02:00
chore: cleanup
This commit is contained in:
parent
d652c12de2
commit
1f1c73b38e
@ -29,9 +29,9 @@ func WithLocksTableName(table string) MigratorOption {
|
||||
|
||||
// WithMarkAppliedOnSuccess sets the migrator to only mark migrations as applied/unapplied
|
||||
// when their up/down is successful
|
||||
func WithMarkAppliedOnSuccess() MigratorOption {
|
||||
func WithMarkAppliedOnSuccess(enabled bool) MigratorOption {
|
||||
return func(m *Migrator) {
|
||||
m.markAppliedOnSuccess = true
|
||||
m.markAppliedOnSuccess = enabled
|
||||
}
|
||||
}
|
||||
|
||||
@ -145,10 +145,9 @@ func (m *Migrator) Migrate(ctx context.Context, opts ...MigrationOption) (*Migra
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
migrations = migrations.Unapplied()
|
||||
|
||||
group := &MigrationGroup{
|
||||
Migrations: migrations.Unapplied(),
|
||||
}
|
||||
group := new(MigrationGroup)
|
||||
if len(group.Migrations) == 0 {
|
||||
return group, nil
|
||||
}
|
||||
@ -164,6 +163,8 @@ func (m *Migrator) Migrate(ctx context.Context, opts ...MigrationOption) (*Migra
|
||||
}
|
||||
}
|
||||
|
||||
group.Migrations = migrations[:i+1]
|
||||
|
||||
if !cfg.nop && migration.Up != nil {
|
||||
if err := migration.Up(ctx, m.db); err != nil {
|
||||
return group, err
|
||||
|
Loading…
x
Reference in New Issue
Block a user