Files
alrahma_sunday_school/app/Database/Migrations/2024-11-05-000700_AddBatchNumberToReimbursements.php
T
2026-09-03 13:14:30 -04:00

36 lines
945 B
PHP

<?php
namespace App\Database\Migrations;
use CodeIgniter\Database\Migration;
class AddBatchNumberToReimbursements extends Migration
{
public function up()
{
if (! $this->db->tableExists('reimbursements') || $this->db->fieldExists('batch_number', 'reimbursements')) {
return;
}
$fields = [
'batch_number' => [
'type' => 'INT',
'constraint' => 11,
'unsigned' => true,
'default' => 0,
'null' => false,
'after' => 'reimbursement_method',
],
];
$this->forge->addColumn('reimbursements', $fields);
}
public function down()
{
if ($this->db->tableExists('reimbursements') && $this->db->fieldExists('batch_number', 'reimbursements')) {
$this->forge->dropColumn('reimbursements', 'batch_number');
}
}
}