<?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('causals', function (Blueprint $table) {
            $table->id();
            $table->unsignedBigInteger('parent_id')->nullable();
            $table->foreign('parent_id')->nullable()->references('id')->on('causals')->onUpdate('cascade')->onDelete('cascade');
            $table->string('name');
            $table->enum('type', ['IN', 'OUT']);
            $table->integer('money')->default(0);
            $table->integer('user_status')->default(0);
            $table->integer('no_first')->default(0);
            $table->integer('enabled')->default(1);
            $table->softDeletes();
            $table->timestamps();
        });
    }

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