<?php

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

class CreateAccountStatementsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('account_statements', function (Blueprint $table) {
            $table->id();
            $table->unsignedBigInteger('statement_account_id');
            $table->date('date_from');
            $table->date('date_to');
            $table->float('total_amount');
            $table->float('begin_balance');
            $table->float('end_balance');
            $table->timestamps();

            $table->foreign('statement_account_id')->references('id')->on('statement_accounts');
        });
    }

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