Blame view

console/migrations/m160210_085744_department.php 509 Bytes
02524a34   Yarik   test
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
  <?php
  
  use yii\db\Migration;
  
  class m160210_085744_department extends Migration
  {
      public function up()
      {
          $this->createTable('{{%department}}', ['department_id' => $this->primaryKey(), 'name' => $this->string()]);
          $this->addForeignKey('team_department_key', '{{%team}}', 'department_id', '{{%department}}', 'department_id');
      }
  
      public function down()
      {
          $this->dropForeignKey('team_department_key', '{{%team}}');
          $this->dropTable('{{%department}}');
      }
  
  }