m160519_124222_create_feedback_company.php 1013 Bytes
<?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');
    }
}