<?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
    {
        Schema::create('property_common_areas', function (Blueprint $table) {
            $table->primary(['property_id', 'common_area_id']);

            $table->unsignedBigInteger('property_id');
            $table->foreign('property_id')->references('id')->on('properties');
            $table->unsignedBigInteger('common_area_id');
            $table->foreign('common_area_id')->references('id')->on('common_areas');

            $table->enum('entity_status',['ACTIVE', 'INACTIVE' ])->default('ACTIVE');
            $table->timestamps();
        });
    }

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