70 lines
2.1 KiB
PHP
70 lines
2.1 KiB
PHP
<?php
|
|
|
|
namespace App\Database\Migrations;
|
|
|
|
use CodeIgniter\Database\Migration;
|
|
|
|
/**
|
|
* Satu set pengaturan presensi terpusat: jam masuk & jam pulang sekolah.
|
|
* Koordinat sekolah tetap di table zones (SMA1-SCHOOL).
|
|
*/
|
|
class CreateSchoolPresenceSettingsTable extends Migration
|
|
{
|
|
public function up()
|
|
{
|
|
$this->forge->addField([
|
|
'id' => [
|
|
'type' => 'INT',
|
|
'constraint' => 11,
|
|
'unsigned' => true,
|
|
'auto_increment' => true,
|
|
],
|
|
'time_masuk_start' => [
|
|
'type' => 'TIME',
|
|
'null' => true,
|
|
'comment' => 'Mulai window absen masuk (misal 06:30)',
|
|
],
|
|
'time_masuk_end' => [
|
|
'type' => 'TIME',
|
|
'null' => true,
|
|
'comment' => 'Akhir window absen masuk (misal 07:00)',
|
|
],
|
|
'time_pulang_start' => [
|
|
'type' => 'TIME',
|
|
'null' => true,
|
|
'comment' => 'Mulai window absen pulang (misal 14:00)',
|
|
],
|
|
'time_pulang_end' => [
|
|
'type' => 'TIME',
|
|
'null' => true,
|
|
'comment' => 'Akhir window absen pulang (misal 14:30)',
|
|
],
|
|
'created_at' => [
|
|
'type' => 'DATETIME',
|
|
'null' => true,
|
|
],
|
|
'updated_at' => [
|
|
'type' => 'DATETIME',
|
|
'null' => true,
|
|
],
|
|
]);
|
|
$this->forge->addKey('id', true);
|
|
$this->forge->createTable('school_presence_settings');
|
|
|
|
// Satu row default
|
|
$this->db->table('school_presence_settings')->insert([
|
|
'time_masuk_start' => '06:30:00',
|
|
'time_masuk_end' => '07:00:00',
|
|
'time_pulang_start' => '14:00:00',
|
|
'time_pulang_end' => '14:30:00',
|
|
'created_at' => date('Y-m-d H:i:s'),
|
|
'updated_at' => date('Y-m-d H:i:s'),
|
|
]);
|
|
}
|
|
|
|
public function down()
|
|
{
|
|
$this->forge->dropTable('school_presence_settings');
|
|
}
|
|
}
|