<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateTalleresTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
       Schema::create('talleres', function (Blueprint $table) {
    $table->id();
    $table->unsignedBigInteger('equipo_id');
    $table->date('fecha_llegada');
    $table->date('fecha_estimada_salida')->nullable();
    $table->date('fecha_entrega')->nullable();
    $table->string('problema');
    $table->text('solucion')->nullable();
    $table->decimal('costo_reparacion', 10, 2)->nullable();
    $table->timestamps();

    $table->foreign('equipo_id')->references('id')->on('equipos')->onDelete('cascade');
    });

    }

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