<?php

use yii\db\Migration;

class m160208_111900_blog extends Migration
{
    public function up()
    {
        $tableOptions = null;

        $this->createTable('{{%blog}}', [
            'blog_id' => $this->primaryKey(),
            'user_id' =>  $this->integer()->notNull(),
            'name' => $this->string(255)->notNull(),
            'link' => $this->string(255),
            'date_add' => $this->timestamp()->notNull(),
            'user_add_id' => $this->integer(),
            'view_count' => $this->integer()->defaultValue(0),
            'description' =>  $this->text(),
            'cover' =>  $this->string(255),
        ], $tableOptions);

    }

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

}
