<?php

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

class CreateGallerySectionsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('gallery_sections', function (Blueprint $table) {
            $table->id();
            $table->string('uid')->unique();
            $table->bigInteger('gallery_id')->unsigned();
            $table->string('name', 255)->nullable();
            $table->text('descriptions')->nullable();
            $table->integer('position');

            $table->timestamps();

            $table->foreign('gallery_id')
                ->references('id')
                ->on('galleries')
                ->onDelete('cascade');
        });
    }

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