Skip to content

Comparator to sort migrations by their namespace in the order of regex-match list.

Notifications You must be signed in to change notification settings

maximaster/doctrine-migration-comparators

Repository files navigation

maximaster/doctrine-migration-match-comaprator

composer require maximaster/doctrine-migration-comparators

NumericComparator

Compares numeric parts of versons as numbers.

MatchComparator

Comparator that prioritize versions which matches first on list of regexps.

You can use other comparator as fallback in case migrations have the same regexp matched. For example: the library's NumericComparator or softspring/doctrine-migrations-version-comparator

Example

config/packages/doctrine_migrations.yaml

doctrine_migrations:
    services:
        Doctrine\Migrations\Version\Comparator: Maximaster\DoctrineMigrationComparators\Comparator\MatchComparator

services.yaml

    Maximaster\DoctrineMigrationComparators\Comparator\MatchComparator:
        arguments:
            -
                - ~MyProject\Process~
                - ~MyProject\Tests~
            - '@Maximaster\DoctrineMigrationComparators\Comparator\NumericComparator'

MyProject\Process migrations would be executed first, then MyProject\Tests.

About

Comparator to sort migrations by their namespace in the order of regex-match list.

Resources

Stars

Watchers

Forks

Packages

No packages published