<?php

use yii\db\Migration;

class m160228_222009_add_template_column_to_trigger_schedule_table extends Migration
{
    public function up()
    {
        $this->addColumn(
            'trigger_schedule',
            'template_id',
            $this->integer(11)->notNull()
        );
        $this->addForeignKey(
            'fk_schedule_template',
            'trigger_schedule', 'template_id',
            'message_template', 'id'
        );
    }

    public function down()
    {
        $this->dropForeignKey(
            'fk_schedule_template',
            'trigger_schedule'
        );
        $this->dropColumn(
            'trigger_schedule',
            'template_id'
        );
    }
}
