Commit 01337758 authored by Shakarim Sapa's avatar Shakarim Sapa

Добавлена миграция таблицы с условиями срабатывания триггера

parent 4df70fb7
<?php
use yii\db\Migration;
use yii\db\Schema;
class m160127_133404_trigger_condition extends Migration
{
// public function up()
// {
//
// }
//
// public function down()
// {
// echo "m160127_133404_trigger_condition cannot be reverted.\n";
//
// return false;
// }
// Use safeUp/safeDown to run migration code within a transaction
public function safeUp()
{
$this->createTable(
'trigger_condition',
[
'id' => Schema::TYPE_PK,
'group_number' => Schema::TYPE_INTEGER.' NOT NULL',
'trigger_id' => Schema::TYPE_INTEGER.' NOT NULL'
]
);
$this->addForeignKey(
'fk_condition_trigger_id',
'trigger_condition', 'trigger_id',
'trigger_trigger', 'id'
);
}
public function safeDown()
{
$this->dropForeignKey(
'fk_condition_trigger_id',
'trigger_condition'
);
$this->dropTable('trigger_condition');
}
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment