Blame view

console/migrations/m160517_072059_delete_product_fk.php 772 Bytes
4253cbec   root   first commit
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
  <?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()
      {
      }
      */
  }