<?php

namespace App\Database\Migrations;

use CodeIgniter\Database\Migration;

class AddPopularCityFlag extends Migration
{
    public function up()
    {
        if (!$this->db->fieldExists('populercity', 'rewarder_cities')) {
            $this->forge->addColumn('rewarder_cities', [
                'populercity' => [
                    'type' => 'TINYINT',
                    'constraint' => 1,
                    'null' => true,
                    'after' => 'name',
                ],
            ]);
        }
    }

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