New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make diff/generate commands more extensible #487
Comments
Well, your project is not using the doctrine/migrations system to handle migrations, so why trying to reuse the DiffCommand while subverting it to a different job ? Adding extension points in the commands to make them reusable with a totally different system is a huge maintenance cost, because they would forbid us to make the architecture of commands evolve (as each place where we have an extension point would be locked) |
Because it's not extensible now. They both looks so similar: generates files by template with some class inside and do raw SQL queries. I think this model could be easily extensible.
phinx also use same model: table in target DB to keep history of migrations.
|
I agree with @garex. Would be great to extend these classes to specify migration name when I create migration. For example, with next syntax:
And I want have as result file with migration named Currently it is possible only with fork. It is not very good. |
@mnvx I think in next 100 years this will be possible )) See doctrine's PR as an example (btw this is real bug fix). doctrine/dbal#2490 |
There's some reasoning why that PR wasn't merged: doctrine/dbal#2490 (comment)
This is done in 1.6+ @alcaeus or @mikeSimonson I think this one can be closed unless any of the remaining extensibility suggestions are worth pursing. |
Template is configurable starting with 1.6.0. Class name is fixed as that determines the version.
File name directly relates to the class name, which in turns leads to the reasoning in your first point.
What for? There's just a bunch of As per @chrisguitarguy, I'm closing this for now. Please feel free to follow up if you feel I haven't considered all the angles. |
@alcaeus if you think this can be implemented without tons of copy-paste, then close it: Copy-paste stuff: https://github.com/ekapusta/doctrine-phinx-bridge-bundle/blob/develop/Command/DiffCommand.php |
This libraries' job is not to provide an extensible framework for generating and running migrations - it's a library for generating and running migrations in its own context. If you want to do it for Phinx, write your own. Just because your library generates code and this library generates code doesn't mean that they need to share an ancestor. |
@alcaeus making extensible code is a hard work than just writing god-mode code for single use. I dont' undertand position of avoiding any extensibility just because of "one-goal". |
@garex You will understand when you will have to maintain it. Have a good day |
To generate Phinx migrations from Doctrine's schema diff I implemented this simple bridge bundle: https://packagist.org/packages/ekapusta/doctrine-phinx-bridge-bundle
But ugly part in it is that I need to reinvent the bicycle over and over as
DiffCommand
has many private methods and uses direct calls for most operations.Just compare https://github.com/doctrine/migrations/blob/master/lib/Doctrine/DBAL/Migrations/Tools/Console/Command/DiffCommand.php and https://github.com/doctrine/migrations/blob/master/lib/Doctrine/DBAL/Migrations/Tools/Console/Command/GenerateCommand.php with https://github.com/ekapusta/doctrine-phinx-bridge-bundle/blob/develop/Command/DiffCommand.php
It would be good if:
The text was updated successfully, but these errors were encountered: