Skip to content

Commit

Permalink
[ADD] repeatable migrations to MigrateAndSeed
Browse files Browse the repository at this point in the history
  • Loading branch information
JohnBra committed Jan 20, 2025
1 parent 9f6c081 commit cbec946
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
5 changes: 5 additions & 0 deletions internal/migration/apply/apply.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@ func MigrateAndSeed(ctx context.Context, version string, conn *pgx.Conn, fsys af
if err != nil {
return err
}
repeatableMigrations, err := list.LoadRepeatableMigrations(fsys)
if err != nil {
return err
}
migrations = append(migrations, repeatableMigrations...)
if err := migration.ApplyMigrations(ctx, migrations, conn, afero.NewIOFS(fsys)); err != nil {
return err
}
Expand Down
4 changes: 4 additions & 0 deletions internal/migration/list/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,3 +103,7 @@ func LoadPartialMigrations(version string, fsys afero.Fs) ([]string, error) {
}
return migration.ListLocalMigrations(utils.MigrationsDir, afero.NewIOFS(fsys), filter)
}

func LoadRepeatableMigrations(fsys afero.Fs) ([]string, error) {
return migration.ListRepeatableMigrations(utils.MigrationsDir, afero.NewIOFS(fsys))
}

0 comments on commit cbec946

Please sign in to comment.