<?php

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

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

            $table->string('titulo');
            $table->text('copete');
            $table->string('imagen')->nullable();
            $table->string('epigrafe')->nullable();
            $table->text('cuerpo');

            $table->timestamps();

            $table->foreignId('tipos_novedad_id');
            $table->foreign('tipos_novedad_id')->references('id')->on('tipos_novedad');

            $table->foreignId('proveedor_id')->nullable();
            $table->foreign('proveedor_id')->references('id')->on('proveedores');
        });
    }

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