Skip to content

Targeting a specific migration in Migrator #3778

@rick-de-water

Description

@rick-de-water

I have found these related issues/pull requests

None

Description

I want to write tests for my migrations, making sure that each up and down migration has the expected result. For this I want to target a specific migration, seeds some data, up and/or down a migration, and validate the resulting data and/or schema.

Migrator::run however does not allow you to target a specific migration. It always applies all of the migrations. This is different for Migrator::undo, which can target a specific version.

Prefered solution

Add a function that allows me to select a target version. Perhaps even singular up and down methods which up/down the next/current migration, which are then composed into run, undo and a version of run with a target version.

Is this a breaking change? Why or why not?

Only if the interface of run is updated. Breaking changes can be avoided by adding a separate method, but this will clutter the public API.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions