pedi3/database/migrations/2024_07_03_224916_tablas_re...

38 lines
930 B
PHP
Raw Normal View History

<?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('regiones', function (Blueprint $table) {
$table->id();
$table->string('nombre', 100);
$table->timestamps();
});
Schema::create('barrios', function (Blueprint $table) {
$table->id();
$table->string('nombre', 100);
$table->unsignedBigInteger('region_id');
2024-03-11 19:13:06 -03:00
$table->timestamps();
2024-03-12 17:43:43 -03:00
$table->foreign('region_id')->references('id')->on('regiones');
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('regiones');
Schema::dropIfExists('barrios');
}
};