<?php

namespace Tenant\Database\Migrations;

use CodeIgniter\Database\Migration;

/**
 * Persists the Hubtel-hosted checkout link so staff can re-open/resend it
 * after the initial redirect, rather than only being available once via
 * flash data right after generation.
 */
class AddCheckoutUrlToPaymentAttempts extends Migration
{
    public function up()
    {
        $this->forge->addColumn('payment_attempts', [
            'checkout_url' => [
                'type'       => 'VARCHAR',
                'constraint' => 500,
                'null'       => true,
                'after'      => 'checkout_id',
            ],
        ]);
    }

    public function down()
    {
        $this->forge->dropColumn('payment_attempts', 'checkout_url');
    }
}
