<?php

use yii\db\Migration;

class m160229_103010_add_trigger_id_column_to_trigger_schedule_table extends Migration
{
    public function up()
    {
        $this->addColumn(
            'trigger_schedule',
            'trigger_id',
            $this->integer(11)->notNull()
        );
        $this->addForeignKey(
            'fk_schedule_trigger',
            'trigger_schedule', 'trigger_id',
            'trigger_trigger', 'id'
        );
    }

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