devsofttech_hms_ci4/app/Database/Migrations/2026-04-28-000103_ChangeOpdAppointmentDateToDATETIME.php

43 lines
1.2 KiB
PHP

<?php
namespace App\Database\Migrations;
use CodeIgniter\Database\Migration;
class ChangeOpdAppointmentDateToDATETIME extends Migration
{
public function up()
{
// Change the apointment_date column from DATE to DATETIME to store both date and time
$this->db->disableForeignKeyChecks();
$this->forge->modifyColumn('opd_master', [
'apointment_date' => [
'type' => 'DATETIME',
'null' => true,
'default' => null,
'comment' => 'Appointment date and time'
]
]);
$this->db->enableForeignKeyChecks();
}
public function down()
{
// Revert the column back to DATE type
$this->db->disableForeignKeyChecks();
$this->forge->modifyColumn('opd_master', [
'apointment_date' => [
'type' => 'DATE',
'null' => true,
'default' => null,
'comment' => 'Appointment date'
]
]);
$this->db->enableForeignKeyChecks();
}
}