<?php

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

class AddPaymentTypeToTailorPaymentsTable extends Migration
{
    public function up()
    {
        if (Schema::hasTable('tailor_payments') && !Schema::hasColumn('tailor_payments', 'payment_type')) {
            Schema::table('tailor_payments', function (Blueprint $table) {
                $table->string('payment_type', 20)->default('regular')->after('amount');
            });
        }
    }

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