<?php

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

class AddBigMenuFields extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::table('big_menus_lang', function (Blueprint $table) {
            $table->text('highlight_cta1')->nullable();
            $table->text('highlight_cta2')->nullable();
            $table->text('highlight_cta3')->nullable();
            $table->string('banner_label', 255)->nullable();
            $table->text('banner_cta')->nullable();
        });
        Schema::table('big_menus', function (Blueprint $table) {
            $table->dateTime('updated_at', 0)->nullable()->default(null)->change();
            $table->unsignedInteger('banner_image_id')->nullable();
            $table->foreign('banner_image_id')->references('id')
                ->on('media_items')->onDelete('SET NULL')->onUpdate('CASCADE');
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::table('big_menus', function (Blueprint $table) {
            $table->dropForeign(['banner_image_id']);
            $table->dropColumn('banner_image_id');
        });
        Schema::table('big_menus_lang', function (Blueprint $table) {
            $table->dropColumn('banner_label');
            $table->dropColumn('highlight_cta1');
            $table->dropColumn('highlight_cta2');
            $table->dropColumn('highlight_cta3');
            $table->dropColumn('banner_cta');
        });
    }
}
