Search code examples
sqlyii2migration

Yii2 migrate dump SQL


Is possible to dump in a file the SQL of the executed migration(s)? (or before executing? like a dry-run)

I took a look into the sources and if I'm not wrong the current implementation doesn't handle it, but probably wouldn't be too complicate to add the option, or I'm missing something?


Solution

  • It's not easy right now but still possible.

    You would have to override yii\db\Command::execute() to return raw SQL instead of executing it.