<?php

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

class CreateTableMoneyInfo extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        //
        Schema::create('money_infos', function(Blueprint $table) {
            $table->increments('id');
            $table->integer('hostel_id')->nullable();
            $table->integer('room_id')->nullable();
            $table->bigInteger('amount')->nullable();
            $table->bigInteger('pay')->nullable();
            $table->bigInteger('remain')->nullable();
            $table->date('date_action')->nullable();

            $table->integer('user_id')->nullable();

            $table->timestamps();
            $table->softDeletes();
        });

        Schema::create('money_details', function(Blueprint $table) {

            $table->increments('id');
            $table->integer('hostel_id')->nullable();
            $table->integer('room_id')->nullable();
            $table->string('name')->nullable();
            $table->integer('value')->nullable();

            $table->integer('money_info_id')->nullable();

            $table->integer('user_id')->nullable();

            $table->timestamps();
            $table->softDeletes();

        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        //
        Schema::drop('money_infos');
        Schema::drop('money_details');
    }
}
