<?php

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

class UpdateSeoContentTable18102019 extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::table('seo_contents', function (Blueprint $table) {
            if (!Schema::hasColumn('seo_contents', 'is_static')) {
                $table->tinyInteger('is_static')->nullable()->default(0);
            }

            if (!Schema::hasColumn('seo_contents', 'url')) {
                $table->string('url')->nullable();
            }

            if (!Schema::hasColumn('seo_contents', 'parameter_one')) {
                $table->string('parameter_one')->nullable();
            }

            if (!Schema::hasColumn('seo_contents', 'parameter_two')) {
                $table->string('parameter_two')->nullable();
            }

            if (!Schema::hasColumn('seo_contents', 'price')) {
                $table->decimal('price', 15, 2)->nullable();
            }

            if (Schema::hasColumn('seo_contents', 'sub_header')) {
                $table->removeColumn('sub_header');
            }
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        //
    }
}
