init backend presensi

This commit is contained in:
mwpn
2026-03-05 14:37:36 +07:00
commit b4fda6b9c9
319 changed files with 27261 additions and 0 deletions

View File

@@ -0,0 +1,60 @@
<?php
namespace App\Database\Migrations;
use CodeIgniter\Database\Migration;
/**
* Token untuk absen mapel via QR: guru generate, siswa scan.
*/
class CreateQrAttendanceTokensTable extends Migration
{
public function up()
{
$this->forge->addField([
'id' => [
'type' => 'INT',
'constraint' => 11,
'unsigned' => true,
'auto_increment' => true,
],
'schedule_id' => [
'type' => 'INT',
'constraint' => 11,
'unsigned' => true,
],
'token' => [
'type' => 'VARCHAR',
'constraint' => 64,
],
'expires_at' => [
'type' => 'DATETIME',
],
'created_by_user_id' => [
'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('token');
$this->forge->addKey('expires_at');
$this->forge->addKey('schedule_id');
$this->forge->addForeignKey('schedule_id', 'schedules', 'id', 'CASCADE', 'CASCADE');
$this->forge->createTable('qr_attendance_tokens');
}
public function down()
{
$this->forge->dropTable('qr_attendance_tokens');
}
}