<?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::table('profile_questions', function ($table) {
            $table->dropForeign('profile_questions_category_id_foreign');
        });
        Schema::table('profile_questions', function ($table) {
            $table->dropColumn('category_id');
        }); */
        Schema::create('profile_category_question', function (Blueprint $table) {
            $table->id();
            $table->unsignedBigInteger('category_id');
            $table->unsignedBigInteger('question_id');

            $table->foreign('category_id')->references('id')->on('profile_categories');
            $table->foreign('question_id')->references('id')->on('profile_questions');
            $table->timestamps();
        });
    }

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