<?php

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

class m160304_091243_fix_user_table extends Migration
{
    // Use safeUp/safeDown to run migration code within a transaction
    public function safeUp()
    {
        $this->alterColumn('users', 'support_id', Schema::TYPE_STRING . '(50) DEFAULT NULL');
        $this->renameColumn('users', 'support_id', 'redmine_key');
    }

    public function safeDown()
    {
        $this->renameColumn('users', 'redmine_key', 'support_id');
        $this->renameColumn('users', 'support_id', Schema::TYPE_INTEGER . '(11) DEFAULT NULL');
    }
}
