<?php

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

class UpdateSliderColumnsIntoSlidersTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::table('sliders', function (Blueprint $table) {
            $table->dropColumn('title');
            $table->dropColumn('content');
            $table->dropColumn('file_name');
            $table->smallInteger('is_internal_url')->default(1)->after('name');
            $table->string('url')->nullable()->after('name');
            $table->mediumText('description')->nullable()->after('name');
            $table->string('image')->nullable()->after('name');
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::table('sliders', function (Blueprint $table) {
            $table->dropColumn('is_internal_url');
            $table->dropColumn('url');
            $table->dropColumn('description');
            $table->dropColumn('image');
            $table->string('title')->nullable()->after('name');
            $table->mediumText('content')->nullable()->after('name');
            $table->string('file_name')->nullable()->after('name');
        });
    }
}
