<?php

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

return new class extends Migration
{
    /**
     * Run the migrations.
     */
    public function up(): void
    {
        Schema::create('issued_cheque', function (Blueprint $table) {
            $table->id();
            $table->unsignedBigInteger('grn_no');
            $table->string('cheque_no')->nullable(false);
            $table->string('bank_name')->nullable(false);
            $table->string('branch_name')->nullable(false);
            $table->string('cheque_date')->nullable(false);
            $table->string('amount')->nullable(false);
            $table->timestamps();

            $table->foreign('grn_no')->references('grn_no')->on('expense')->onDelete('cascade');
        });
    }

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