<?php

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

class Libros extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('libros', function (Blueprint $table) {
            //$table->bigIncrements('id_libro');
            $table->bigincrements('id_libro');
            $table->string('codigo_libro',20);
            $table->string('isbn_libro',200)->unique();
            $table->string('titulo_libro',150);
            $table->string('subtitulo_libro',250);
            $table->string('autor_libro',150);
            $table->year('publicacion_libro');
            $table->string('editorial_libro',250);
            $table->string('ediccion_libro',250);
            $table->string('idioma_libro',200);
            $table->bigInteger('ejemplares_libro');
            $table->string('prestados_libro',10);
            $table->string('imagen_libro',250);
            $table->string('Descripcion',250);
            $table->unsignedBigInteger('id_genero');
            $table->foreign('id_genero')->references('id')->on('generos')->onUpdate('restrict')->onDelete('restrict');
            $table->timestamps();

        });
    }

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