32 lines
884 B
PHP
32 lines
884 B
PHP
<?php
|
|
|
|
namespace App\Database\Migrations;
|
|
|
|
use CodeIgniter\Database\Migration;
|
|
|
|
class AddFaceExternalIdToStudentsTable extends Migration
|
|
{
|
|
public function up()
|
|
{
|
|
// Add nullable face_external_id column for linking to external face-recognition ID
|
|
$this->forge->addColumn('students', [
|
|
'face_external_id' => [
|
|
'type' => 'VARCHAR',
|
|
'constraint' => 100,
|
|
'null' => true,
|
|
'after' => 'dapodik_id',
|
|
],
|
|
]);
|
|
|
|
// Unique index so one face ID hanya milik satu siswa
|
|
$this->forge->addUniqueKey('face_external_id', 'students_face_external_id_unique');
|
|
}
|
|
|
|
public function down()
|
|
{
|
|
$this->forge->dropKey('students', 'students_face_external_id_unique');
|
|
$this->forge->dropColumn('students', 'face_external_id');
|
|
}
|
|
}
|
|
|