Loading database/migrations/2024_06_10_154242_create_dependencias_table.php 0 → 100644 +34 −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('dependencias', function (Blueprint $table) { $table->id(); $table->string('nombre'); $table->timestamps(); }); Schema::table('users', function(Blueprint $table){ $table->unsignedBigInteger('dependencia_id'); $table->foreign('dependencia_id')->references('id')->on('dependencias'); }); } /** * Reverse the migrations. */ public function down(): void { Schema::dropIfExists('dependencias'); } }; Loading
database/migrations/2024_06_10_154242_create_dependencias_table.php 0 → 100644 +34 −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('dependencias', function (Blueprint $table) { $table->id(); $table->string('nombre'); $table->timestamps(); }); Schema::table('users', function(Blueprint $table){ $table->unsignedBigInteger('dependencia_id'); $table->foreign('dependencia_id')->references('id')->on('dependencias'); }); } /** * Reverse the migrations. */ public function down(): void { Schema::dropIfExists('dependencias'); } };