Skip to content
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

[Feature] Display the migration output from the base Doctrine migrator. #62

Open
garret-gunter opened this issue Feb 14, 2018 · 2 comments

Comments

@garret-gunter
Copy link
Contributor

garret-gunter commented Feb 14, 2018

Detailed Description

Currently only the migration notes are displayed. But any other output from the base doctrine migrator won't be written to console.

Context

It would be nice to see the extra output from doctrine. I made a quick, dirty solution to show the difference.

Current behavior:
image

With doctrine output:
image

Possible Implementation

Doctrine's \Doctrine\DBAL\Migrations\Configuration\Configuration class has an outputWriter property. The property must be an instance of \Doctrine\DBAL\Migrations\OutputWriter. Here is my dirty workaround.

I set the output writer after retrieving the configuration from the provider.

$configuration = $provider->getForConnection(
$this->option('connection') ?: null
);

        $configuration->setOutputWriter(new OutputWriter(function($message){
                // Get  the current command's output handler.
        	$output = $this->getOutput();
               // Verify the handler exists and that we want extra output.
        	if($output && $output->isVerbose()){
                        // Write the output to a new line.
        		$output->write($message,true);
	        }
        }));

I don't know how to get an Artisan command's output handler from the ConfigurationFactory. The only way I know how is to get it from the command itself.

Edit

The command could also pass it's output handler to the ConfigurationProvider::getForConnection() method.

@patrickbrouwers
Copy link
Contributor

Sorry for the late reply. Happy to accept a PR for it.

@garret-gunter
Copy link
Contributor Author

This might be something for us to handle when updating to doctrine/migrations 2.x.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants