<?php

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

class CreateStatementTransactionsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('statement_transactions', function (Blueprint $table) {
            $table->id();
            $table->unsignedBigInteger('account_statement_id');
            $table->dateTime('transaction_date')->nullable();
            $table->dateTime('posting_date');
            $table->string('transaction_description')->nullable();
            $table->string('transaction_description_2')->nullable();
            $table->string('transaction_description_3')->nullable();
            $table->string('transaction_description_4')->nullable();
            $table->string('transaction_description_5')->nullable();
            $table->string('transaction_ref')->nullable();
            $table->decimal('amount', 15, 2)->unsigned(false);
            $table->string('teller_id')->nullable();
            $table->string('branch_channel');
            $table->string('transaction_code');
            $table->string('end_balance')->nullable();
            $table->timestamps();

            $table->foreign('account_statement_id')->references('id')->on('account_statements');
        });
    }

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