<?php

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

class CreateNewsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('news', function (Blueprint $table) {
            $table->increments('id');
            $table->integer('section_id')->unsigned()->nullable();
            $table->foreign('section_id')->references('id')->on('sections');
            $table->integer('region_1_id')->unsigned()->nullable();
            $table->foreign('region_1_id')->references('id')->on('sections');
            $table->integer('region_2_id')->unsigned()->nullable();
            $table->foreign('region_2_id')->references('id')->on('sections');
            $table->string('title');
            $table->string('title_region_1')->nullable();
            $table->string('title_region_2')->nullable();
            $table->string('text_short')->nullable();
            $table->text('text')->nullable();
            $table->string('image')->nullable();
            $table->boolean('online');
            $table->boolean('homepage');
            $table->datetime('date')->nullable();
            $table->timestamps();
        });
    }

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