Commit a28e20ac authored by Alfonso Rafael Solis Rangel's avatar Alfonso Rafael Solis Rangel
Browse files

Migracion de subgrupos

parent ff3a342e
Loading
Loading
Loading
Loading
+33 −0
Original line number Diff line number Diff line
<?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('subgrupos', function (Blueprint $table) {
            $table->id();
            $table->string('nombre');
            $table->unsignedBigInteger('grupo_id')->nullable();
            $table->unsignedBigInteger('subgrupo_id')->nullable();

            $table->foreign('grupo_id')->references('id')->on('grupos')->nullable();
            $table->foreign('subgrupo_id')->references('id')->on('subgrupos')->nullable();
            $table->timestamps();
        });
    }

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