<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class AddUniqueKeyToBalanceTableByTypeAndTypeIdBalancesTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::table('balances', function (Blueprint $table) {
            $table->unique(['type', 'type_id'], 'balances_type_type_id_unique');
        });
    }

    public function down()
    {
        Schema::table('balances', function (Blueprint $table) {
            $table->dropUnique('balances_type_type_id_unique');
        });
    }
}
