<?php

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

class CreateServiceVoucherDetailsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('service_voucher_details', function (Blueprint $table) {
            $table->id();
            $table->foreignId('service_voucher_id')
                ->constrained('service_vouchers')
                ->cascadeOnDelete();

            $table->string('control_account_id');
            $table->decimal('qty', 12, 2)->default(0);
            $table->string('unit', 50)->nullable();
            $table->decimal('price', 12, 2)->default(0);
            $table->decimal('amount', 14, 2)->default(0);
            $table->string('narration')->nullable();
            $table->timestamps();
        });
    }

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