<?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
    {
        if (!Schema::hasTable('jewelry_diamonds')) {

            Schema::create('jewelry_diamonds', function (Blueprint $table) {
                $table->id();
                $table->foreignId('jewelry_id')->constrained()->onDelete('cascade');

                $table->string('diamond_type')->nullable();
                $table->string('diamond_size')->nullable();
                $table->integer('diamond_pcs')->nullable();
                $table->decimal('diamond_ct', 10, 2)->nullable();
                $table->decimal('diamond_rate', 10, 2)->nullable();
                $table->decimal('diamond_value', 10, 2)->nullable();

                $table->timestamps();
            });

        }
    }

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