Files
alrahma_sunday_school/app/Database/Migrations/2026-04-13-000002_AddClassSectionToEventCharges.php
root 716cc8b8d3
Tests / PHPUnit (push) Failing after 1m20s
fix school year for all tables
2026-07-18 14:45:38 -04:00

37 lines
917 B
PHP

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