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,52 @@
<?php
namespace App\Database\Migrations;
use CodeIgniter\Database\Migration;
class CreateTeacherSubjectsTable extends Migration
{
public function up()
{
$this->forge->addField([
'id' => [
'type' => 'INT',
'constraint' => 11,
'unsigned' => true,
'auto_increment' => true,
],
'teacher_user_id' => [
'type' => 'INT',
'constraint' => 11,
'unsigned' => true,
],
'subject_id' => [
'type' => 'INT',
'constraint' => 11,
'unsigned' => true,
],
'created_at' => [
'type' => 'DATETIME',
'null' => true,
],
'updated_at' => [
'type' => 'DATETIME',
'null' => true,
],
]);
$this->forge->addKey('id', true);
$this->forge->addUniqueKey(['teacher_user_id', 'subject_id'], 'teacher_subjects_unique');
$this->forge->addForeignKey('teacher_user_id', 'users', 'id', 'CASCADE', 'CASCADE', 'teacher_subjects_teacher_fk');
$this->forge->addForeignKey('subject_id', 'subjects', 'id', 'CASCADE', 'CASCADE', 'teacher_subjects_subject_fk');
$this->forge->createTable('teacher_subjects');
}
public function down()
{
$this->forge->dropForeignKey('teacher_subjects', 'teacher_subjects_teacher_fk');
$this->forge->dropForeignKey('teacher_subjects', 'teacher_subjects_subject_fk');
$this->forge->dropTable('teacher_subjects');
}
}