<?php

use yii\db\Migration;

/**
 * Class m211003_183453_create_table_user_trainer_assignment
 */
class m211003_183453_create_table_user_trainer_assignment extends Migration
{
    /**
     * {@inheritdoc}
     */
    public function safeUp()
    {
        $tableOptions = null;
        if ($this->db->driverName === 'mysql') {
            // http://stackoverflow.com/questions/766809/whats-the-difference-between-utf8-general-ci-and-utf8-unicode-ci
            $tableOptions = 'CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE=InnoDB';
        }

        $this->createTable('{{%user_trainer_assignment}}', [
            'id_user_trainer_assignment' => $this->primaryKey(),
            'id_user' =>  $this->integer(11) ,
            'id_trainer' =>  $this->integer(11) ,
        ], $tableOptions);
    }

    /**
     * {@inheritdoc}
     */
    public function safeDown()
    {
        echo "m211003_183453_create_table_user_trainer_assignment cannot be reverted.\n";

        return false;
    }

    /*
    // Use up()/down() to run migration code without a transaction.
    public function up()
    {

    }

    public function down()
    {
        echo "m211003_183453_create_table_user_trainer_assignment cannot be reverted.\n";

        return false;
    }
    */
}
