<?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('pos_order_tables', function (Blueprint $table) {
            $table->id();
            $table->foreignId('order_id')->constrained('pos_orders')->onDelete('cascade');
            $table->foreignId('table_id')->constrained('pos_tables')->onDelete('cascade');
            $table->timestamps();
            
            $table->unique(['order_id', 'table_id']);
        });
    }

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