Files
alrahma_sunday_school/app/Database/Migrations/2026-08-27-000350_AddTuitionFeeToInvoiceStudentsList.php
root 38644b32ae
Deploy to Shared Hosting / Shared hosting deploy (push) Failing after 48s
Tests / PHPUnit (push) Failing after 1m19s
fix invoice and enrollment fees
2026-08-27 18:34:36 -04:00

39 lines
1.0 KiB
PHP

<?php
declare(strict_types=1);
namespace App\Database\Migrations;
use CodeIgniter\Database\Migration;
final class AddTuitionFeeToInvoiceStudentsList extends Migration
{
public function up(): void
{
if (! $this->db->tableExists('invoice_students_list')
|| $this->db->fieldExists('tuition_fee', 'invoice_students_list')) {
return;
}
$this->forge->addColumn('invoice_students_list', [
'tuition_fee' => [
'type' => 'DECIMAL',
'constraint' => '10,2',
'null' => false,
'default' => '0.00',
'after' => 'enrolled',
],
]);
$this->db->resetDataCache();
}
public function down(): void
{
if ($this->db->tableExists('invoice_students_list')
&& $this->db->fieldExists('tuition_fee', 'invoice_students_list')) {
$this->forge->dropColumn('invoice_students_list', 'tuition_fee');
$this->db->resetDataCache();
}
}
}