<?php

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

class m151014_053236_add__table__account_state extends Migration
{
    public function up()
    {
    	$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('{{%account_state}}', [
    			'id_account_state' => $this->primaryKey(),
    			'id_account' => $this->integer(11),
    			'type' => $this->smallInteger(),
    			'money' => $this->integer(11),
    			'banknote_5_ft' => $this->integer(11),
    			'banknote_10_ft' => $this->integer(11),
    			'banknote_20_ft' => $this->integer(11),
    			'banknote_50_ft' => $this->integer(11),
    			'banknote_100_ft' => $this->integer(11),
    			'banknote_200_ft' => $this->integer(11),
    			'banknote_500_ft' => $this->integer(11),
    			'banknote_1000_ft' => $this->integer(11),
    			'banknote_2000_ft' => $this->integer(11),
    			'banknote_5000_ft' => $this->integer(11),
    			'banknote_10000_ft' => $this->integer(11),
    			'banknote_20000_ft' => $this->integer(11),
    			'id_user' => $this->integer(11),
    			'created_at' => $this->dateTime()->notNull(),
    			'updated_at' =>  $this->dateTime()->notNull(),
    	], $tableOptions);
    }

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

        return false;
    }

    /*
    // Use safeUp/safeDown to run migration code within a transaction
    public function safeUp()
    {
    }

    public function safeDown()
    {
    }
    */
}
