<?php

use yii\db\Migration;

/**
 * Handles the creation of table `bills`.
 */
class m181121_153329_create_bills_table extends Migration
{
    /**
     * {@inheritdoc}
     */
    public function Up()
    {
        $this->createTable('bills', [
            'id' => $this->primaryKey(11),
            'user_id' => $this->integer(11),
            'type' => $this->string(15),
            'bid_id' => $this->integer(11),
            'payed' => $this->integer(1)->Null(),
            'auction_id' => $this->integer(11),
        ]);
        $this->createIndex('idx-bills-userid', 'bills', 'user_id', 0);
        $this->createIndex('idx-bills-type', 'bills', 'type', 0);
        $this->createIndex('idx-bills-bidid', 'bills', 'bid_id', 0);
        $this->createIndex('idx-bills-payed', 'bills', 'payed', 0);
        $this->createIndex('idx-bills-aucid', 'bills', 'auction_id', 0);
    }

    /**
     * {@inheritdoc}
     */
    public function Down()
    {
        $this->dropIndex('idx-bills-userid','bills');
        $this->dropIndex('idx-bills-type','bills');
        $this->dropIndex('idx-bills-bidid','bills');
        $this->dropIndex('idx-bills-payed','bills');
        $this->dropIndex('idx-bills-aucid','bills');
        $this->dropTable('bills');
    }
}
