Files
presensi/app/Database/Migrations/2026-03-05-130000_CreateStudentFacesTable.php
2026-03-05 14:37:36 +07:00

59 lines
1.6 KiB
PHP

<?php
namespace App\Database\Migrations;
use CodeIgniter\Database\Migration;
class CreateStudentFacesTable 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,
],
'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');
}
}