39 lines
1.0 KiB
PHP
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();
|
|
}
|
|
}
|
|
}
|