<?php

namespace App\Database\Migrations;

use CodeIgniter\Database\Migration;

class Patroli extends Migration
{
    public function up()
    {
        $this->forge->addField([
            'id_patroli' => [
                'type'           => 'INT',
                'constraint'     => 11,
                'unsigned'       => true,
                'auto_increment' => true,
            ],
            'nama_petugas' => [
                'type'       => 'VARCHAR',
                'constraint' => '150',
            ],
            'lokasi_blok' => [
                'type'       => 'VARCHAR',
                'constraint' => '100',
            ],
            'temuan' => [
                'type'       => 'TEXT',
            ],
            'foto_bukti' => [
                'type'       => 'VARCHAR',
                'constraint' => '255',
                'null'       => true,
            ],
            'waktu_input' => [
                'type' => 'DATETIME',
            ],
        ]);
        $this->forge->addKey('id_patroli', true);
        $this->forge->createTable('tb_patroli');
    }

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