<?php

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

class AddMeterageToCurtainBeddingDetailsTable extends Migration
{
    public function up()
    {
        if (Schema::hasTable('curtain_bedding_details') && !Schema::hasColumn('curtain_bedding_details', 'meterage')) {
            Schema::table('curtain_bedding_details', function (Blueprint $table) {
                $table->string('meterage')->nullable()->after('width');
            });
        }
    }

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