forge->addField([ 'id' => [ 'type' => 'INT', 'constraint' => 11, 'unsigned' => true, 'auto_increment' => true, ], 'student_id' => [ 'type' => 'INT', 'constraint' => 11, 'unsigned' => true, ], 'embedding' => [ 'type' => 'LONGTEXT', 'null' => false, 'comment' => 'JSON string float[] embedding wajah', ], 'source' => [ 'type' => 'ENUM', 'constraint' => ['formal', 'live', 'live_avg'], 'default' => 'formal', ], 'quality_score' => [ 'type' => 'FLOAT', 'null' => true, ], 'created_at' => [ 'type' => 'DATETIME', 'null' => true, ], 'updated_at' => [ 'type' => 'DATETIME', 'null' => true, ], ]); $this->forge->addKey('id', true); $this->forge->addKey('student_id'); $this->forge->addForeignKey('student_id', 'students', 'id', 'CASCADE', 'CASCADE', 'student_faces_student_fk'); $this->forge->createTable('student_faces'); } public function down() { $this->forge->dropTable('student_faces'); } }