<?php

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

class CreateLeyendaFormatosTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('gtv_leyendaformatos', function (Blueprint $table) {
            $table->engine = "InnoDB";
            $table->charset = 'utf8';
            $table->collation = 'utf8_unicode_ci';
            $table->increments('id_leyfor')->unsigned();
            $table->string('derecha_leyfor')->nullable();
            $table->string('izquierda_leyfor')->nullable();
            $table->integer('id_for')->unsigned();
            $table->foreign('id_for')->references('id_for')->on('gtv_formatos')->onDelete('restrict')->onUpdate('cascade');
            $table->timestamps();
        });
    }

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