Files
alrahma_sunday_school/app/Database/Migrations/2026-02-04-000400_CreatePlacementLevels.php
T
2026-02-10 22:11:06 -05:00

37 lines
1.3 KiB
PHP

<?php
namespace App\Database\Migrations;
use CodeIgniter\Database\Migration;
class CreatePlacementLevels extends Migration
{
public function up()
{
if ($this->db->tableExists('placement_levels')) {
return;
}
$this->forge->addField([
'id' => ['type' => 'INT', 'constraint' => 11, 'unsigned' => true, 'auto_increment' => true],
'student_id' => ['type' => 'INT', 'constraint' => 11, 'unsigned' => true],
'level' => ['type' => 'SMALLINT', 'constraint' => 3, 'unsigned' => true],
'school_year' => ['type' => 'VARCHAR', 'constraint' => 20],
'created_by' => ['type' => 'INT', 'constraint' => 11, 'unsigned' => true, 'null' => true],
'updated_by' => ['type' => 'INT', 'constraint' => 11, 'unsigned' => true, 'null' => true],
'created_at' => ['type' => 'DATETIME', 'null' => true],
'updated_at' => ['type' => 'DATETIME', 'null' => true],
]);
$this->forge->addKey('id', true);
$this->forge->addKey(['student_id', 'school_year'], true);
$this->forge->addKey('school_year');
$this->forge->createTable('placement_levels');
}
public function down()
{
$this->forge->dropTable('placement_levels', true);
}
}