<?php

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

class CreateFarmerReturnInvoicesTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('farmer_return_invoices', function (Blueprint $table) {
            $table->id();
            $table->date('date');
            $table->string('invoice_no', 20)->index();
            $table->foreignId("farmer_id")->constrained()->cascadeOnDelete()->cascadeOnUpdate();
            $table->double("qty");
            $table->double("total");
            $table->foreignId("user_id")->constrained()->cascadeOnDelete()->cascadeOnUpdate();
            $table->mediumText("note")->nullable();
            $table->timestamps();
        });
    }

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