m160509_214535_customer.php 1.02 KB
<?php

use yii\db\Migration;

class m160509_214535_customer extends Migration
{
    public function up()
    {

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


            'id' => $this->primaryKey(),
            'username' => $this->string()->notNull(),
            'password' => $this->string()->notNull(),
            'name' => $this->string()->notNull(),
            'surname' => $this->string(),
            'phone' => $this->string(),
            'date_time' => $this->date()->defaultExpression('NOW()'),
            'sex' => $this->string(32),
            'birth_day' => $this->integer(),
            'birth_month' => $this->integer(),
            'birth_year' => $this->integer(),
            'body' => $this->text(),
            'group_id' => $this->integer(),
        ]);
    }

    public function down()
    {
        $this->dropTable('{{%customer}}');
    }

    /*
    // Use safeUp/safeDown to run migration code within a transaction
    public function safeUp()
    {
    }

    public function safeDown()
    {
    }
    */
}