<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration {
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('member_attributes', function (Blueprint $table): void {
            $table->id();
            $table->unsignedInteger('member_id');
            $table->string('name');
            $table->mediumText('value');
            $table->timestamps();

            $table
                ->foreign('member_id')
                ->references('id')
                ->on('members')
                ->onDelete('CASCADE');
        });
    }

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