<?php

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

return new class extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */

    public function up()
    {
        if (!Schema::hasColumn('subscriptions', 'nowpayment_invoice_id')) {
            Schema::table('subscriptions', function (Blueprint $table) {
                $table->string('nowpayment_invoice_id')->nullable();
            });
        }

        if (!Schema::hasColumn('package_orders', 'nowpayment_invoice_id')) {
            Schema::table('package_orders', function (Blueprint $table) {
                $table->string('nowpayment_invoice_id')->nullable();
            });
        }

        if (!Schema::hasColumn('product_orders', 'nowpayment_invoice_id')) {
            Schema::table('product_orders', function (Blueprint $table) {
                $table->string('nowpayment_invoice_id')->nullable();
            });
        }
        if (!Schema::hasColumn('course_purchases', 'nowpayment_invoice_id')) {
            Schema::table('course_purchases', function (Blueprint $table) {
                $table->string('nowpayment_invoice_id')->nullable();
            });
        }
        if (!Schema::hasColumn('event_details', 'nowpayment_invoice_id')) {
            Schema::table('event_details', function (Blueprint $table) {
                $table->string('nowpayment_invoice_id')->nullable();
            });
        }
        if (!Schema::hasColumn('donation_details', 'nowpayment_invoice_id')) {
            Schema::table('donation_details', function (Blueprint $table) {
                $table->string('nowpayment_invoice_id')->nullable();
            });
        }
    }


    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        
    }
};
