<?php

namespace App\Database\Migrations;

use CodeIgniter\Database\Migration;

class AddQrToRewarderShops extends Migration
{
    public function up()
    {
        if (!$this->db->fieldExists('qr_type', 'rewarder_shops')) {
            $this->forge->addColumn('rewarder_shops', [
                'qr_type' => [
                    'type' => 'VARCHAR',
                    'constraint' => 10,
                    'null' => true,
                ],
            ]);
        }
    }

    public function down()
    {
        if ($this->db->fieldExists('qr_type', 'rewarder_shops')) {
            $this->forge->dropColumn('rewarder_shops', 'qr_type');
        }
    }
}

