Blame view

console/migrations/m160519_124222_create_feedback_company.php 1.02 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
35
36
  <?php

  

  use yii\db\Migration;

  

  /**

   * Handles the creation for table `feedback_company`.

   */

  class m160519_124222_create_feedback_company extends Migration

  {

      /**

       * @inheritdoc

       */

      public function up()

      {

          $this->createTable('feedback_company', [

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

              'date_add' => $this->integer()->notNull(),

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

              'phone' => $this->string()->notNull(),

              'ip' => $this->string()->notNull(),

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

              'status' => $this->integer()->notNull()->defaultValue(1),

          ]);

  

          $this->addForeignKey('feedback_company_user', '{{%feedback_company}}', 'user_id', '{{%user}}', 'id', 'CASCADE', 'CASCADE');

      }

  

      /**

       * @inheritdoc

       */

      public function down()

      {

          $this->dropForeignKey('feedback_company_user', '{{%feedback_company}}');

          $this->dropTable('feedback_company');

      }

  }