<?php

use yii\db\Migration;

class m160517_072059_delete_product_fk extends Migration
{
    public function up()
    {
        $this->dropForeignKey('orders_products_fk', '{{%orders_products}}');
        $this->dropForeignKey('orders_products_items_fk', '{{%orders_products}}');
    }

    public function down()
    {

        $this->addForeignKey('orders_products_fk', '{{%orders_products}}', 'order_id', '{{%orders}}', 'id', 'CASCADE', 'CASCADE');
        $this->addForeignKey('orders_products_items_fk', '{{%orders_products}}', 'id', '{{%product}}', 'product_id', 'RESTRICT', 'RESTRICT');
    }

    /*
    // Use safeUp/safeDown to run migration code within a transaction
    public function safeUp()
    {
    }

    public function safeDown()
    {
    }
    */
}
