Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### Fixed

- Fix possible nil pointer panic when using nil `opts` in `Migrator.MigrateTx`. [PR #1117](https://github.com/riverqueue/river/pull/1117).

## [0.29.0] - 2025-12-22

### Added
Expand Down
12 changes: 8 additions & 4 deletions rivermigrate/river_migrate.go
Original file line number Diff line number Diff line change
Expand Up @@ -385,6 +385,10 @@ func (m *Migrator[TTx]) ValidateTx(ctx context.Context, tx TTx) (*ValidateResult

// migrateDown runs down migrations.
func (m *Migrator[TTx]) migrateDown(ctx context.Context, exec riverdriver.Executor, direction Direction, opts *MigrateOpts, inOuterTx bool) (*MigrateResult, error) {
if opts == nil {
opts = &MigrateOpts{}
}

existingMigrations, err := m.existingMigrations(ctx, exec)
if err != nil {
return nil, err
Expand Down Expand Up @@ -434,6 +438,10 @@ func (m *Migrator[TTx]) migrateDown(ctx context.Context, exec riverdriver.Execut

// migrateUp runs up migrations.
func (m *Migrator[TTx]) migrateUp(ctx context.Context, exec riverdriver.Executor, direction Direction, opts *MigrateOpts, inOuterTx bool) (*MigrateResult, error) {
if opts == nil {
opts = &MigrateOpts{}
}

existingMigrations, err := m.existingMigrations(ctx, exec)
if err != nil {
return nil, err
Expand Down Expand Up @@ -493,10 +501,6 @@ func (m *Migrator[TTx]) validate(ctx context.Context, exec riverdriver.Executor)
// Common code shared between the up and down migration directions that walks
// through each target migration and applies it, logging appropriately.
func (m *Migrator[TTx]) applyMigrations(ctx context.Context, exec riverdriver.Executor, direction Direction, opts *MigrateOpts, inOuterTx bool, sortedTargetMigrations []Migration) (*MigrateResult, error) {
if opts == nil {
opts = &MigrateOpts{}
}

var maxSteps int
switch {
case opts.MaxSteps != 0:
Expand Down
Loading