<?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('ms_group_user', function (Blueprint $table) {
            $table->id('MsGroupUserId');
            $table->foreignId('ms_group_id')->comment('FK Group');
            $table->foreignId('user_id')->comment('FK User');
            $table->timestamps();

            $table->foreign('user_id')->references('id')->on('users')->cascadeOnDelete();
            $table->foreign('ms_group_id')->references('MsGroupId')->on('ms_group')->cascadeOnDelete();
        });
    }

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