<?php

namespace App\Database\Migrations;

use CodeIgniter\Database\Migration;

class TitikPeta extends Migration
{
    public function up()
    {
        $this->forge->addField([
            'id_titik' => [
                'type'           => 'INT',
                'constraint'     => 11,
                'unsigned'       => true,
                'auto_increment' => true,
            ],
            'nama_lokasi' => [
                'type'       => 'VARCHAR',
                'constraint' => '150',
            ],
            'kategori' => [
                'type'       => 'ENUM',
                'constraint' => ['Kantor', 'Rawan Karhutla', 'Rehabilitasi', 'Patroli'],
                'default'    => 'Patroli',
            ],
            'latitude' => [
                'type'       => 'VARCHAR',
                'constraint' => '50',
            ],
            'longitude' => [
                'type'       => 'VARCHAR',
                'constraint' => '50',
            ],
            'deskripsi' => [
                'type'       => 'TEXT',
                'null'       => true,
            ],
        ]);
        $this->forge->addKey('id_titik', true);
        $this->forge->createTable('tb_peta');
    }

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