<?php

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

class CreateNewsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('news', function (Blueprint $table) {
            $table->id();
            $table->string("name");
            $table->string('subname');
            $table->text("content");
            $table->foreignId('resource_id')->nullable()->constrained('resources', 'id');
            $table->integer("arrangement_id")->nullable(); //Gets ID from given event, menu, guide or news
            $table->foreignid("type_id")->nullable()->constrained("news_types", "id");
            $table->timestamps();
        });
    }

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