<?php

namespace App\Database\Migrations\Master;

use CodeIgniter\Database\Migration;

class LogActivity extends Migration
{
    public function up()
    {
        $fields = [
            'user_id' => ['type' => 'int', 'constraint' => 11, 'unsigned' => true],
            'fullname' => ['type' => 'varchar', 'constraint' => 255,],
            'user_type' => ['type' => 'ENUM', 'constraint' => ['1', '2'], 'default' => '1'],
            'detail' => ['type' => 'text',  'null' => true],
            'ip' => ['type' => 'char', 'constraint' => 64],
            'created_at' => ['type' => 'int', 'constraint' => 11, 'unsigned' => true],
        ];
        $this->forge->addField($fields);
        $this->forge->createTable('log_activity', true);
    }

    public function down()
    {
        $this->forge->dropTable('log_activity', true);
    }
}
