<?php
namespace App\Database\Migrations;

use CodeIgniter\Database\Migration;

class CreateAreaGeoTable extends Migration {
  public function up() {
    
    $this->forge->addField([
      'AreaGeoID' => ['type' => 'INT', 'constraint' => 11, 'unsigned' => true, 'auto_increment' => true],
      'AreaCode' => ['type' => 'varchar', 'constraint' => 20, 'null' => true],
      'Class' => ['type' => 'int', 'null' => true],
      'AreaName' => ['type' => 'VARCHAR', 'constraint' => 100,  'null' => false],
      'Parent' => ['type' => 'int', 'null' => true],
    ]);
    
    $this->forge->addKey('AreaGeoID', true);
    $this->forge->createTable('areageo');
  }

  public function down() {
    $this->forge->dropTable('areageo');
  }
}