<?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('task_collections', function (Blueprint $table) {
            $table->id();
            $table->json('name');
            $table->json('description')->nullable();
            $table->timestamps();
        });

        Schema::create('task_collection_task', function (Blueprint $table) {
            $table->unsignedBigInteger('task_collection_id');
            $table->unsignedBigInteger('task_id');
            $table->primary(['task_collection_id','task_id']);
        });
    }

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