Files
alrahma_sunday_school/app/Database/Migrations/2026-02-04-000410_UpdatePlacementLevelRange.php
2026-02-10 22:11:06 -05:00

41 lines
988 B
PHP

<?php
namespace App\Database\Migrations;
use CodeIgniter\Database\Migration;
class UpdatePlacementLevelRange extends Migration
{
public function up()
{
if (!$this->db->tableExists('placement_levels')) {
return;
}
$fields = $this->db->getFieldNames('placement_levels');
if (!in_array('level', $fields, true)) {
return;
}
$this->forge->modifyColumn('placement_levels', [
'level' => ['type' => 'SMALLINT', 'constraint' => 3, 'unsigned' => true],
]);
}
public function down()
{
if (!$this->db->tableExists('placement_levels')) {
return;
}
$fields = $this->db->getFieldNames('placement_levels');
if (!in_array('level', $fields, true)) {
return;
}
$this->forge->modifyColumn('placement_levels', [
'level' => ['type' => 'TINYINT', 'constraint' => 1, 'unsigned' => true],
]);
}
}