<?php

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

class CreateSectionTypeTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('section_type', function (Blueprint $table) {
            $table->string('id')->primary();
            $table->string('section_type_id')->nullable();
            $table->string('key', 45);
            $table->string('value', 45);
            $table->timestamp('created_at')->useCurrent();
            $table->string('position', 45)->nullable();
            $table->timestamp('updated_at')->nullable();
        });

        Schema::table('section_type', function (Blueprint $table) {
            $table->foreign('section_type_id', 'FK_3b651447d8cae99d6cc6a5ed9c5')
                  ->references('id')
                  ->on('section_type')
                  ->onDelete('set null');
        });
    }

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