<?php

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

class AddSoapLabExamToVcAppointments extends Migration
{
    public function up()
    {
        Schema::table('vc_appointments', function (Blueprint $table) {
            if (!Schema::hasColumn('vc_appointments', 'soap_lab_investigations')) {
                $table->text('soap_lab_investigations')->nullable()->after('soap_investigations');
            }
            if (!Schema::hasColumn('vc_appointments', 'soap_exam_investigations')) {
                $table->text('soap_exam_investigations')->nullable()->after('soap_lab_investigations');
            }
        });
    }

    public function down()
    {
        Schema::table('vc_appointments', function (Blueprint $table) {
            if (Schema::hasColumn('vc_appointments', 'soap_lab_investigations')) {
                $table->dropColumn('soap_lab_investigations');
            }
            if (Schema::hasColumn('vc_appointments', 'soap_exam_investigations')) {
                $table->dropColumn('soap_exam_investigations');
            }
        });
    }
}
