db->tableExists('student_decisions')) { return; } $this->forge->addField([ 'id' => [ 'type' => 'INT', 'constraint' => 11, 'unsigned' => true, 'auto_increment' => true, ], 'student_id' => [ 'type' => 'INT', 'constraint' => 11, 'unsigned' => true, ], 'semester' => [ 'type' => 'VARCHAR', 'constraint' => 20, ], 'school_year' => [ 'type' => 'VARCHAR', 'constraint' => 20, ], 'class_section_name' => [ 'type' => 'VARCHAR', 'constraint' => 100, 'null' => true, ], 'semester_score' => [ 'type' => 'DECIMAL', 'constraint' => '8,2', 'null' => true, ], 'decision' => [ 'type' => 'VARCHAR', 'constraint' => 100, 'null' => true, ], 'source' => [ 'type' => 'ENUM', 'constraint' => ['auto', 'manual', 'pending'], 'default' => 'auto', ], 'notes' => [ 'type' => 'TEXT', 'null' => true, ], 'generated_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->addUniqueKey(['student_id', 'semester', 'school_year']); $this->forge->addKey(['school_year', 'semester']); $this->forge->createTable('student_decisions'); } public function down() { $this->forge->dropTable('student_decisions', true); } }