Blame view

migrations/m170831_094035_comment_add_foreogn_key.php 831 Bytes
08b5c1c4   Anastasia   comments in admin
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
31
32
33
34
35
36
37
  <?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;
      }
      */
  }