Blame view

console/migrations/m160202_090343_user_add_fields.php 1.09 KB
14a09168   Alex Savenko   init 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
31
32
33
34
  <?php

  

  use yii\db\Schema;

  use yii\db\Migration;

  

  class m160202_090343_user_add_fields extends Migration

  {

      public function up()

      {

          $this->addColumn('user', 'type', $this->smallInteger());

          $this->addColumn('user_info', 'image', $this->string());

          $this->addColumn('user_info', 'poster', $this->string());

          $this->addColumn('user_info', 'member', $this->smallInteger());

  

          $this->createTable('{{%company_info}}', [

              'company_info_id' => $this->primaryKey(),

              'name' => $this->string(255)->notNull(),

              'staff' => $this->integer(),

              'street' => $this->string(255),

              'house' => $this->string(255),

              'hide_mail' => $this->smallInteger(),

              'user_id' => $this->integer(),

          ], null);

      }

  

      public function down()

      {

          $this->dropColumn('user', 'type');

          $this->dropColumn('user_info', 'image');

          $this->dropColumn('user_info', 'poster');

          $this->dropColumn('user_info', 'member');

          $this->dropTable('company_info');

      }

  }