<?php

namespace App\Database\Migrations;

use CodeIgniter\Database\Migration;

class CreateJobTitle extends Migration
{
    public function up()
    {
        $this->forge->addField([
            'job_title_id' => [
                'type' => 'INT',
                'constraint' => 11,
                'unsigned' => true,
                'auto_increment' => true,
            ],
            'job_title_name' => [
                'type' => 'VARCHAR',
                'constraint' => 255,
            ],
            
            // Common fields
            'created_at' => [
                'type' => 'DATETIME',
                'null' => true,
            ],
            'created_by' => [
                'type' => 'VARCHAR', 
                'constraint' => '20', 
                'null' => true
            ],
            'updated_at' => [
                'type' => 'DATETIME',
                'null' => true,
            ],
            'updated_by' => [
                'type' => 'VARCHAR', 
                'constraint' => '20', 
                'null' => true
            ],
            'deleted_at' => [
                'type' => 'DATETIME',
                'null' => true,
            ],
        ]);
        $this->forge->addKey('job_title_id', true);
        $this->forge->createTable('job_title');
    }

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