Blame view

console/migrations/m160329_085324_file_add_user.php 452 Bytes
3735dff7   Yarik   test
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
  <?php
  
  use yii\db\Migration;
  
  class m160329_085324_file_add_user extends Migration
  {
      public function up()
      {
          $this->addColumn('{{%file}}', 'user_id', $this->integer());
          $this->addForeignKey('file_user', '{{%file}}', 'user_id', '{{%user}}', 'id', 'SET DEFAULT', 'CASCADE');
      }
  
      public function down()
      {
          $this->dropForeignKey('file_user', '{{%file}}');
          $this->dropColumn('{{%file}}', 'user_id');
      }
  }