51 lines
1.4 KiB
PHP
51 lines
1.4 KiB
PHP
<?php
|
|
|
|
namespace App\Database\Migrations;
|
|
|
|
use CodeIgniter\Database\Migration;
|
|
|
|
class RemoveRegistrationAndMandatoryFees extends Migration
|
|
{
|
|
public function up()
|
|
{
|
|
if (! $this->db->tableExists('school_years')) {
|
|
return;
|
|
}
|
|
|
|
foreach (['registration_fee', 'mandatory_fees'] as $column) {
|
|
if ($this->db->fieldExists($column, 'school_years')) {
|
|
$this->forge->dropColumn('school_years', $column);
|
|
}
|
|
}
|
|
}
|
|
|
|
public function down()
|
|
{
|
|
if (! $this->db->tableExists('school_years')) {
|
|
return;
|
|
}
|
|
|
|
if (! $this->db->fieldExists('registration_fee', 'school_years')) {
|
|
$this->forge->addColumn('school_years', [
|
|
'registration_fee' => [
|
|
'type' => 'DECIMAL',
|
|
'constraint' => '10,2',
|
|
'default' => 0,
|
|
'after' => 'adult_student_registration_enabled',
|
|
],
|
|
]);
|
|
}
|
|
|
|
if (! $this->db->fieldExists('mandatory_fees', 'school_years')) {
|
|
$this->forge->addColumn('school_years', [
|
|
'mandatory_fees' => [
|
|
'type' => 'DECIMAL',
|
|
'constraint' => '10,2',
|
|
'default' => 0,
|
|
'after' => 'tuition_due_at_registration',
|
|
],
|
|
]);
|
|
}
|
|
}
|
|
}
|