Blame view

console/migrations/m161226_102102_user_data.php 774 Bytes
3bc9af21   Yarik   Layout
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
  <?php
  
  use yii\db\Migration;
  
  class m161226_102102_user_data extends Migration
  {
      public function up()
      {
          $this->createTable('user_data', [
              'id' => $this->primaryKey(),
              'user_id' => $this->integer(),
              'name' => $this->string(255),
              'surname' => $this->string(255),
              'patronymic' => $this->string(255),
              'phone' => $this->string(255),
              'email' => $this->string(255),
              'inn' => $this->string(255),
          ]);
          
          $this->addForeignKey('user_data_fk', 'user_data', 'user_id', 'user', 'id', 'CASCADE', 'CASCADE');
      }
  
      public function down()
      {
          $this->dropForeignKey('user_data_fk', 'user_data');
          $this->dropTable('user_data');
      }
  }