<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Support\Facades\DB;

return new class extends Migration
{
    public function up(): void
    {
        DB::statement("ALTER TABLE pos_transactions DROP CONSTRAINT IF EXISTS pos_transactions_payment_status_check");
        DB::statement("ALTER TABLE pos_transactions ADD CONSTRAINT pos_transactions_payment_status_check CHECK (payment_status IN ('completed', 'partially_paid', 'refunded', 'partially_refunded'))");
    }

    public function down(): void
    {
        DB::statement("ALTER TABLE pos_transactions DROP CONSTRAINT IF EXISTS pos_transactions_payment_status_check");
        DB::statement("ALTER TABLE pos_transactions ADD CONSTRAINT pos_transactions_payment_status_check CHECK (payment_status IN ('completed', 'refunded', 'partially_refunded'))");
    }
};
