<?php

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

class m160119_110151_create__table__ticket__installment_request 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('{{%ticket_installment_request}}', [
    			'id_ticket_installment_request' => $this->primaryKey(),
    			'id_ticket' => $this->integer(11),
    			'id_customer' => $this->integer(11),
    			'id_transfer' => $this->integer(11),
    			'status' => $this->integer(11),
    			'money' => $this->integer(11),
    			'customer_name' => $this->string(),
    			'bank_name' => $this->string(),
    			'bank_address' => $this->string(),
    			'bank_account' => $this->string(),
    			'priority' => $this->integer(11),
    			'request_sent_at' => $this->dateTime(),
    			'request_processed_at' => $this->dateTime(),
    			'request_target_time_at' => $this->dateTime(),
    			'created_at' => $this->dateTime()->notNull(),
    			'updated_at' =>  $this->dateTime()->notNull(),
    	], $tableOptions);
    }

    public function down()
    {
    }

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

    public function safeDown()
    {
    }
    */
}
