doctrine / migrations

Doctrine Database Migrations Library
https://www.doctrine-project.org/projects/migrations.html
MIT License
4.65k stars 387 forks source link

Compare versions of migrations without namespace #1421

Open beregovoy opened 3 months ago

beregovoy commented 3 months ago

Strip namespace, so namespace do not affect version comparsion.

Q A
Type bug/feature/improvement
BC Break no
Fixed issues

Summary

Previous behaviour Migrations\Version2022 will always migrate AFTER Brand\Migrations\Version2024, but based on pure versions - Version2022 SHOULD be migrated BEFORE Version2024.

ZBrand\Migrations\Version2024 - will migrate AFTER Migrations\Version2022. So comparsion was not actually performed on version, but on namespace first. Which is kind of wrong, non intuitive, and break namespace functional.

New behaviour ignore namespace, and compare versions only by version. Default behaviour should not depend on namespace. If someone need to override it - he should did it explicitly for project.

beregovoy commented 3 months ago

I may add tests, if concept will be accepted

SenseException commented 2 months ago

Hi @beregovoy

it does make sense to have some expectations about the order of executed, but changing this in version 3.7 would be a bc break. I'd expect that this could be the default comparator in 4.0. A new comparator instance could still be injected manually in older versions though.