m170831_094035_comment_add_foreogn_key.php 831 Bytes
<?php

use yii\db\Migration;

class m170831_094035_comment_add_foreogn_key extends Migration
{
    public function safeUp()
    {
            $this->addForeignKey('comment_customer',
                                'artbox_comment',
                                'customer_id',
                                'customer',
                                'id',
                                'CASCADE',
                                'CASCADE');
    }

    public function safeDown()
    {
        $this->dropForeignKey('comment_customer', 'artbox_comment');
    }

    /*
    // Use up()/down() to run migration code without a transaction.
    public function up()
    {

    }

    public function down()
    {
        echo "m170831_094035_comment_add_foreogn_key cannot be reverted.\n";

        return false;
    }
    */
}