<?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('blog_post_adsense', function (Blueprint $table) {
            $table->id();
            $table->foreignId('post_id')->constrained('blog_posts')->onDelete('cascade');
            $table->foreignId('adsense_zone_id')->constrained('adsense_zones')->onDelete('cascade');
            $table->string('position')->default('in_content')->comment('top, bottom, in_content, sidebar');
            $table->timestamps();

            $table->unique(['post_id', 'adsense_zone_id']);
        });
    }

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