<?php

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

class CreateUserMetaDatasTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('user_meta_datas', function (Blueprint $table) {
            $table->id();
            $table->unsignedBigInteger('user_id'); // Define as unsignedBigInteger
            $table->string('user_meta_name', 191)->index()->nullable();
            $table->string('user_meta_value')->nullable();
            $table->timestamps();

            // Define the foreign key relationship
            $table->foreign('user_id')->references('id')->on('users')->cascadeOnDelete();
        });
    }

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