<?php

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

class Prestamos extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('prestamos', function (Blueprint $table) {
            //$table->bigIncrements('id_libro');

            $table->bigincrements('id');
            //$table->bigInteger('id_libro');
            $table->unsignedBigInteger('id_libro');
            $table->foreign('id_libro')->references('id_libro')->on('libros')->ondelete('restrict')->onUpdate('restrict');
            $table->unsignedBigInteger('id_lector');
            $table->foreign('id_lector')->references('IdEstudiante')->on('estudiantes')->ondelete('restrict')->onUpdate('restrict');
            $table->string('fechaprestamo',100);
            $table->string('fechadevolucion',100);
            $table->tinyInteger('estado_prestamo');
            $table->unsignedBigInteger('id_usuario');
            $table->foreign('id_usuario')->references('id')->on('tipoRol')->ondelete('restrict')->onUpdate('restrict');
            $table->timestamps();

        });
    }

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