Edit File: 2023_10_20_134151_create_regions_table.php
<?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('regions', function (Blueprint $table) { $table->id(); $table->text('name'); $table -> unsignedBigInteger( 'country_id' ) -> unsigned() -> index(); $table -> foreign( 'country_id' ) -> references( 'id' ) -> on( 'countries' )-> onDelete( 'cascade' ); $table->timestamps(); }); } /** * Reverse the migrations. * * @return void */ public function down() { Schema::dropIfExists('regions'); } };
Back to File Manager