<?php

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

return new class extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('limit_journals', function (Blueprint $table) {
            $table->id();
            $table->morphs('journalable');
            $table->string('previous_balance');
            $table->string('total_debit')->nullable()->comment('Should be in positive value');
            $table->string('total_credit')->nullable()->comment('Should be in negative value');
            $table->string('type');
            $table->string('balance');
            $table->text('description');

            $table->timestamps();
            $table->softDeletes();
            $table->unsignedBigInteger('created_by')->nullable()->index();
            $table->unsignedBigInteger('updated_by')->nullable()->index();
            $table->unsignedBigInteger('deleted_by')->nullable()->index();
        });
    }

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