<?php

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

class UpdateLabsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::table('labs', function (Blueprint $table) {
            //
            $table->dropColumn(['background_type','background','header_type','header','footer_type','footer']);
            if (!Schema::hasColumn('labs','background_fill_type')) {
                $table->string('background_fill_type')->nullable();
            }
            if (!Schema::hasColumn('labs','background_color')) {
                $table->string('background_color')->nullable();
            }
                if (!Schema::hasColumn('labs','background_image')) {
                    $table->string('background_image')->nullable();
                }
            if (!Schema::hasColumn('labs','header_fill_type')) {
                $table->string('header_fill_type')->nullable();
            }
            if (!Schema::hasColumn('labs','header_color')) {
                $table->string('header_color')->nullable();
            }
            if (!Schema::hasColumn('labs','header_image')) {
                $table->string('header_image')->nullable();
            }
            if (!Schema::hasColumn('labs','footer_fill_type')) {
                $table->string('footer_fill_type')->nullable();
            }
            if (!Schema::hasColumn('labs','footer_color')) {
                $table->string('footer_color')->nullable();
            }
            if (!Schema::hasColumn('labs','footer_image')) {
                $table->string('footer_image')->nullable();
            }
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::table('labs', function (Blueprint $table) {
            //
            $table->dropColumn(['background_fill_type',
                'background_color',
                'background_image',
                'header_fill_type',
                'header_color',
                'header_image',
                'footer_fill_type',
                'footer_color',
                'footer_image']);
        });
    }
}
