<?php

use yii\db\Migration;

class m160317_141523_add_hashes_table_for_auth extends Migration
{
    // Use safeUp/safeDown to run migration code within a transaction
    public function safeUp()
    {
        $this->createTable(
            'auth_hashes',
            [
                'id' => $this->primaryKey(),
                'email' => $this->string(255)->notNull(),
                'hash' => $this->string(50)->notNull(),
                'auth_count' => $this->integer(11)->defaultValue(0),
                'valid_date' => $this->dateTime()->notNull()
            ]
        );
    }

    public function safeDown()
    {
        $this->dropTable('auth_hashes');
    }
}
