migrations icon indicating copy to clipboard operation
migrations copied to clipboard

Improve migrations configuration: use 'folder=>ns' instead of 'ns=>folder'

Open gggeek opened this issue 4 years ago • 1 comments

Feature Request

Q A
New Feature yes
RFC yes
BC Break if not handled properly

Summary

the flexibility of having different migrations namespaces available to manage different priority levels for the migrations execution order is good, but it can be overwhelming for developers coming from previous versions of the bundle. In order to avoid shoot-in-the-foot situations, as well as make it easier to take full advantage of the flexibility allowed, developers should have a simple way to map a migration namespace to multiple on-disk folders.

I thus propose that the default configuration format is modified, so that the list is not namespace => folder, but folder => namespace instead. This would be a BC break of course, but it might be possible to have some smart code which handles it transparently, eg. by looking the up the array elements, and when finding that those correspond to the "old" version, swapping them transparently

See the discussion at https://github.com/doctrine/migrations/issues/1074#issuecomment-803882363

gggeek avatar Mar 22 '21 09:03 gggeek

PS: maybe a less-intrusive alternative would be to allow (and document) usage of namespace => [folder,+] in the configurations, however this seems more complex to me than the proposal above (as in: it would be harder to write custom code that generates the correct configuration)

gggeek avatar Mar 22 '21 09:03 gggeek