How to output SQL queries from Yii2 migrations before running them?

Viewed 45

Is there any tool or programming technique to capture the output from Yii2 migrations to up/down SQL scripts, that is, print the migration corresponding raw SQL before finally running php yii migrate?

For example, in Laravel you can add a flag --pretend to output the queries to the terminal, like in php artisan migrate --pretend. Is there anything similar in Yii Framework?

1 Answers

As @Bizley said when commenting the question, there is not a native way of doing it for Yii2 until the moment this question was answered.

For my case I just tracked my MySQL DB log and picked the queries I was looking for, since I had to set the current DB into a new one through migrations.

Related