Files
alrahma_sunday_school/app/Database/Migrations/2025-10-21-110000_CreatePromotionQueue.php
2026-02-10 22:11:06 -05:00

90 lines
2.7 KiB
PHP

<?php
namespace App\Database\Migrations;
use CodeIgniter\Database\Migration;
class CreatePromotionQueue extends Migration
{
public function up()
{
$this->forge->addField([
'id' => [
'type' => 'INT',
'constraint' => 11,
'unsigned' => true,
'auto_increment' => true,
],
'student_id' => [
'type' => 'INT',
'constraint' => 11,
'unsigned' => true,
'null' => false,
],
'from_class_section_id' => [
'type' => 'INT',
'constraint' => 11,
'unsigned' => true,
'null' => true,
'default' => null,
],
'to_class_id' => [
'type' => 'INT',
'constraint' => 11,
'unsigned' => true,
'null' => false,
],
'to_class_section_id' => [
'type' => 'INT',
'constraint' => 11,
'unsigned' => true,
'null' => true,
'default' => null,
],
'school_year_from' => [
'type' => 'VARCHAR',
'constraint' => 9,
'null' => false,
],
'school_year_to' => [
'type' => 'VARCHAR',
'constraint' => 9,
'null' => false,
],
'status' => [
'type' => 'ENUM',
'constraint' => ['queued','assigned','applied','cancelled'],
'default' => 'queued',
],
'created_at' => [
'type' => 'DATETIME',
'null' => true,
'default' => null,
],
'updated_at' => [
'type' => 'DATETIME',
'null' => true,
'default' => null,
],
'updated_by' => [
'type' => 'INT',
'constraint' => 11,
'unsigned' => true,
'null' => true,
'default' => null,
],
]);
$this->forge->addKey('id', true);
$this->forge->addKey(['student_id', 'school_year_to'], false, true, 'uq_student_year_to');
$this->forge->addKey('to_class_id');
$this->forge->createTable('promotion_queue', true);
}
public function down()
{
$this->forge->dropTable('promotion_queue', true);
}
}