db->fieldExists('emp_created_by', 'employees')) { $this->forge->addColumn('employees', [ 'emp_created_by' => [ 'type' => 'VARCHAR', 'constraint' => 50, 'null' => true, 'default' => null, 'after' => 'emp_status', 'comment' => 'Creator role: HR / USER', ], ]); } if (! $this->db->fieldExists('processed_by', 'employees')) { $this->forge->addColumn('employees', [ 'processed_by' => [ 'type' => 'VARCHAR', 'constraint' => 50, 'null' => true, 'default' => null, 'after' => 'emp_created_by', 'comment' => 'Processor role: HR / ACM (approve or reject)', ], ]); } // employee_polices: who created the policy row, who processed (HR / ACM) if (! $this->db->fieldExists('emp_policy_created_by', 'employee_polices')) { $this->forge->addColumn('employee_polices', [ 'emp_policy_created_by' => [ 'type' => 'VARCHAR', 'constraint' => 50, 'null' => true, 'default' => null, 'after' => 'status', 'comment' => 'Creator role: HR / USER', ], ]); } if (! $this->db->fieldExists('processed_by', 'employee_polices')) { $this->forge->addColumn('employee_polices', [ 'processed_by' => [ 'type' => 'VARCHAR', 'constraint' => 50, 'null' => true, 'default' => null, 'after' => 'emp_policy_created_by', 'comment' => 'Processor role: HR / ACM (approve or reject)', ], ]); } } public function down() { if ($this->db->fieldExists('processed_by', 'employees')) { $this->forge->dropColumn('employees', 'processed_by'); } if ($this->db->fieldExists('emp_created_by', 'employees')) { $this->forge->dropColumn('employees', 'emp_created_by'); } if ($this->db->fieldExists('processed_by', 'employee_polices')) { $this->forge->dropColumn('employee_polices', 'processed_by'); } if ($this->db->fieldExists('emp_policy_created_by', 'employee_polices')) { $this->forge->dropColumn('employee_polices', 'emp_policy_created_by'); } } }