Skip to content

Commit cbec946

Browse files
committed
[ADD] repeatable migrations to MigrateAndSeed
1 parent 9f6c081 commit cbec946

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

internal/migration/apply/apply.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,11 @@ func MigrateAndSeed(ctx context.Context, version string, conn *pgx.Conn, fsys af
1515
if err != nil {
1616
return err
1717
}
18+
repeatableMigrations, err := list.LoadRepeatableMigrations(fsys)
19+
if err != nil {
20+
return err
21+
}
22+
migrations = append(migrations, repeatableMigrations...)
1823
if err := migration.ApplyMigrations(ctx, migrations, conn, afero.NewIOFS(fsys)); err != nil {
1924
return err
2025
}

internal/migration/list/list.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,3 +103,7 @@ func LoadPartialMigrations(version string, fsys afero.Fs) ([]string, error) {
103103
}
104104
return migration.ListLocalMigrations(utils.MigrationsDir, afero.NewIOFS(fsys), filter)
105105
}
106+
107+
func LoadRepeatableMigrations(fsys afero.Fs) ([]string, error) {
108+
return migration.ListRepeatableMigrations(utils.MigrationsDir, afero.NewIOFS(fsys))
109+
}

0 commit comments

Comments
 (0)