pedi3/database/migrations/2024_07_03_225341_tabla_ped...

34 lines
867 B
PHP
Raw Normal View History

2024-03-11 19:41:52 -03:00
<?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('pedidos', function (Blueprint $table) {
$table->id();
$table->string('nombre', 100);
$table->boolean('terminado')->default(false);
$table->boolean('pagado')->default(false);
2024-03-11 19:41:52 -03:00
$table->unsignedBigInteger('barrio_id');
$table->timestamps();
2024-03-12 17:43:43 -03:00
$table->foreign('barrio_id')->references('id')->on('barrios');
$table->unique(['barrio_id','nombre']);
2024-03-11 19:41:52 -03:00
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('pedidos');
}
};