<?php

use yii\db\Migration;

class m161226_103451_user_passport extends Migration
{
    public function up()
    {
        $this->createTable('user_passport', [
            'id' => $this->primaryKey(),
            'user_id' => $this->integer(),
            'series' => $this->string(255),
            'number' => $this->string(255),
            'birthday' => $this->string(255),
            'given_by' => $this->text(),
        ]);
        
        $this->addForeignKey('user_passport_fk', 'user_passport', 'user_id', 'user', 'id', 'CASCADE', 'CASCADE');
    }
    
    public function down()
    {
        $this->dropForeignKey('user_passport_fk', 'user_passport');
        $this->dropTable('user_passport');
    }
}
