nhance/app/Database/Migrations/2026-08-04-064500_AddRejectReasonToEmployeesAndEmployeePolices.php

46 lines
1.4 KiB
PHP

<?php
namespace App\Database\Migrations;
use CodeIgniter\Database\Migration;
class AddRejectReasonToEmployeesAndEmployeePolices extends Migration
{
public function up()
{
if (! $this->db->fieldExists('reject_reason', 'employees')) {
$this->forge->addColumn('employees', [
'reject_reason' => [
'type' => 'TEXT',
'null' => true,
'default' => null,
'after' => 'processed_by',
'comment' => 'Reason when dependent addition is rejected',
],
]);
}
if (! $this->db->fieldExists('reject_reason', 'employee_polices')) {
$this->forge->addColumn('employee_polices', [
'reject_reason' => [
'type' => 'TEXT',
'null' => true,
'default' => null,
'after' => 'processed_by',
'comment' => 'Reason when dependent addition is rejected',
],
]);
}
}
public function down()
{
if ($this->db->fieldExists('reject_reason', 'employees')) {
$this->forge->dropColumn('employees', 'reject_reason');
}
if ($this->db->fieldExists('reject_reason', 'employee_polices')) {
$this->forge->dropColumn('employee_polices', 'reject_reason');
}
}
}