Files
alrahma_sunday_school/app/Database/Migrations/2025-10-19-000300_CreateLateSlipLogs.php
T
2026-02-10 22:11:06 -05:00

80 lines
2.1 KiB
PHP

<?php
namespace App\Database\Migrations;
use CodeIgniter\Database\Migration;
class CreateLateSlipLogs extends Migration
{
public function up()
{
if ($this->db->tableExists('late_slip_logs')) {
return;
}
$this->forge->addField([
'id' => [
'type' => 'INT',
'constraint' => 11,
'unsigned' => true,
'auto_increment' => true,
],
'school_year' => [
'type' => 'VARCHAR',
'constraint' => 32,
'null' => true,
],
'student_name' => [
'type' => 'VARCHAR',
'constraint' => 191,
'null' => false,
],
'slip_date' => [
'type' => 'DATE',
'null' => true,
],
'time_in' => [
'type' => 'TIME',
'null' => true,
],
'grade' => [
'type' => 'VARCHAR',
'constraint' => 64,
'null' => true,
],
'reason' => [
'type' => 'VARCHAR',
'constraint' => 255,
'null' => true,
],
'admin_name' => [
'type' => 'VARCHAR',
'constraint' => 191,
'null' => true,
],
'printed_by' => [
'type' => 'INT',
'constraint' => 11,
'null' => true,
],
'printed_at' => [
'type' => 'DATETIME',
'null' => false,
],
]);
$this->forge->addKey('id', true);
$this->forge->addKey(['school_year']);
$this->forge->addKey(['student_name']);
$this->forge->createTable('late_slip_logs', true);
}
public function down()
{
if ($this->db->tableExists('late_slip_logs')) {
$this->forge->dropTable('late_slip_logs', true);
}
}
}