<?php

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

class CreatePetVaccinationRecordsTable extends Migration
{
    public function up()
    {
        Schema::create('pet_vaccination_records', function (Blueprint $table) {
            $table->bigIncrements('PVR_Id');
            $table->integer('PVR_Sr_No')->nullable();

            $table->unsignedBigInteger('PR_Id')->nullable();
            $table->unsignedBigInteger('VM_Id')->nullable();

            $table->date('Vaccination_Date')->nullable();
            $table->date('Next_Due_Date')->nullable();

            $table->string('Certificate_No', 30)->nullable();
            $table->longText('Certificate_File')->nullable();

            $table->string('Verification_Status', 50)->nullable();
            $table->string('Verified_By', 100)->nullable();
            $table->dateTime('Verified_Date')->nullable();

            $table->timestamps();
            $table->softDeletes();

            // FK
            $table->foreign('PR_Id')->references('PR_Id')->on('pet_registration')->onDelete('cascade');
            $table->foreign('VM_Id')->references('VM_Id')->on('vaccine_master')->onDelete('cascade');
        });
    }

    public function down()
    {
        Schema::dropIfExists('pet_vaccination_records');
    }
}
