<?php

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

class CreateVersionsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('versions', function (Blueprint $table) {
            $table->bigIncrements('id');
            $table->string('version_number');
            $table->morphs('versionable');
            $table->dateTime('published_at')->nullable();
            $table->unsignedBigInteger('publisher_id')->nullable();

            $table->string('name')->nullable()->index();
            $table->string('title')->nullable();
            $table->string('slug')->nullable();
            $table->string('theme')->nullable();
            $table->unsignedBigInteger('parent_page_id')->nullable();
            $table->string('sort_order')->nullable();
            $table->boolean('unlisted')->default(false);
            $table->boolean('show_sub_menu')->default(false);
            $table->string('footer_color')->nullable();
            $table->unsignedBigInteger('footer_fg_photo_id')->nullable();
            $table->unsignedBigInteger('footer_bg_photo_id')->nullable();
            $table->dateTime('publish_at')->nullable();

            $table->timestamps();
        });
    }

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