<?php

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

class UdpateDebt extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        //
        Schema::table('debts', function(Blueprint $table) {
          $table->integer('user_id')->nullable();
        });

        Schema::create('debt_histories', function(Blueprint $table) {
           $table->increments('id');
           $table->integer('room_id')->nullable();
           $table->integer('amount_change')->nullable();
           $table->integer('collect_spend_id')->nullbale();
           $table->integer('user_id')->nullbale();
           $table->timestamps();
           $table->softDeletes();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        //
        Schema::table('debts', function(Blueprint $table) {
            $table->dropColumn('user_id');
        });
        Schema::drop('debt_histories');
    }
}
