41 lines
988 B
PHP
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],
|
|
]);
|
|
}
|
|
}
|