<?php

namespace App\Database\Migrations;

use CodeIgniter\Database\Migration;

class AddTransactionPaymentInfo extends Migration
{
    public function up()
    {
        $this->forge->addColumn('transactions', [
            'payment_method' => ['type' => 'VARCHAR', 'constraint' => 20, 'null' => true, 'default' => 'cash', 'after' => 'total'],
            'amount_paid' => ['type' => 'INT', 'constraint' => 11, 'null' => true, 'after' => 'payment_method'],
        ]);
    }

    public function down()
    {
        $this->forge->dropColumn('transactions', ['payment_method', 'amount_paid']);
    }
}
