<?php

use yii\db\Migration;
use \yii\db\Schema;

class m160204_115214_add_schedule_table extends Migration
{
    // Use safeUp/safeDown to run migration code within a transaction
    public function safeUp()
    {
        $this->createTable(
            'trigger_schedule',
            [
                'id' => Schema::TYPE_PK,
                'sended' => Schema::TYPE_BOOLEAN.' DEFAULT 0 NOT NULL',
                'checked' => Schema::TYPE_BOOLEAN.' DEFAULT 0 NOT NULL',
                'message_id' => Schema::TYPE_INTEGER.' DEFAULT NULL',
                'message' => Schema::TYPE_TEXT.' NOT NULL',
                'email' => Schema::TYPE_STRING.' NOT NULL',
                'time' => Schema::TYPE_DATETIME,
                'date_create' => Schema::TYPE_DATETIME
            ]
        );
    }

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