<?php

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

class AddGroupNameToVcSoapOptions extends Migration
{
    public function up()
    {
        if (Schema::hasTable('vc_soap_options') && !Schema::hasColumn('vc_soap_options', 'group_name')) {
            Schema::table('vc_soap_options', function (Blueprint $table) {
                $table->string('group_name', 60)->nullable()->after('species');
            });
        }
    }

    public function down()
    {
        if (Schema::hasTable('vc_soap_options') && Schema::hasColumn('vc_soap_options', 'group_name')) {
            Schema::table('vc_soap_options', function (Blueprint $table) {
                $table->dropColumn('group_name');
            });
        }
    }
}
