<?php

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

return new class extends Migration
{
    public function up(): void
    {
        Schema::create('meal_post_ingredients', function (Blueprint $table) {
            $table->id();
            $table->foreignUlid('meal_posts_id')->constrained('meal_posts')->cascadeOnDelete();
            $table->integer('position');
            $table->unsignedInteger('quantity')->default(1);
            $table->string('ingredient');
            $table->string('unit');
            $table->timestamps();
        });
    }

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