Migration

I always use migration to create a database, but I get the problem when not get dba access. Dba administrator asks plain SQL to be deployed. How do I get SQL from migration files that exist?

Do it locally and backup db

If you have a plain SQL file to create a database you can use it in your migration:


class m000000_000000_create_from_file() extends \yii\db\Migration

{

    public function up()

    {

        $this->db->createCommand(file_get_contents('/path/to/myddl.sql'))->execute();

    }

}