<?php

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

class m160128_131700_add_index_transfer_id_object_type extends Migration
{
    public function up()
    {
    	$this->execute("CREATE INDEX transfer_object_type ON transfer (id_object,type);");
    	$this->execute("CREATE INDEX transfer_object_type_status ON transfer (id_object,type,status);");
    	$this->execute("CREATE INDEX transfer_status ON transfer (status);");
    	$this->execute("CREATE INDEX transfer_paid_by ON transfer (paid_by);");
    	$this->execute("CREATE INDEX transfer_paid_at ON transfer (paid_at);");
    	$this->execute("CREATE INDEX transfer_paid_at_by ON transfer (paid_by,paid_at);");
    	$this->execute("CREATE INDEX transfer_discount ON transfer (id_discount);");
    	$this->execute("CREATE INDEX transfer_customer ON transfer (id_customer);");
    	$this->execute("CREATE INDEX transfer_user ON transfer (id_user);");
    	$this->execute("CREATE INDEX transfer_created ON transfer (created_at);");
    }

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

        return false;
    }

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

    public function safeDown()
    {
    }
    */
}
