<?php

namespace App\Database\Migrations;

use CodeIgniter\Database\Migration;

class AddRewardInfoToTransactions extends Migration
{
    public function up()
    {
        $this->forge->addColumn('transactions', [
            'discount_amount' => ['type' => 'INT', 'constraint' => 11, 'null' => true, 'after' => 'total'],
            'reward_name' => ['type' => 'VARCHAR', 'constraint' => 150, 'null' => true, 'after' => 'discount_amount'],
        ]);
    }

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