<?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('esg_paragraphs', function (Blueprint $table) {
            $table->id();
            $table->foreignId('esg_id')->constrained()->onDelete('cascade');
            $table->tinyInteger("type")->comment("1: 純editor 2:表格 3:影片 or 圖片 4:左右圖文");
            $table->json("content");
            $table->integer("order")->comment("排序");
            $table->timestamps();
            $table->index(['esg_id', 'order']);
        });
    }

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