m151109_085627_update_news_img.php
597 Bytes
<?php
use yii\db\Schema;
use yii\db\Migration;
class m151109_085627_update_news_img extends Migration
{
    public function safeUp()
    {
        $view = <<< MySQL
        update
            w_news
        set img = CONCAT('/storage/news/',img);
MySQL;
        $this->execute($view);
    }
    public function down()
    {
        echo "m151109_085627_update_news_img cannot be reverted.\n";
        return true;
    }
    /*
    // Use safeUp/safeDown to run migration code within a transaction
    public function safeUp()
    {
    }
    public function safeDown()
    {
    }
    */
}