doctor-appointment-system/app/Database/Migrations/2026-04-22-000000_CreateDaysTable.php
2026-05-08 12:22:08 +05:30

28 lines
906 B
PHP

<?php
namespace App\Database\Migrations;
use CodeIgniter\Database\Migration;
class CreateDaysTable extends Migration
{
public function up(): void
{
$this->forge->addField([
'id' => ['type' => 'INT', 'unsigned' => true, 'auto_increment' => true],
'day_number' => ['type' => 'INT', 'unsigned' => true, 'comment' => '1=Monday, 2=Tuesday, 3=Wednesday, 4=Thursday, 5=Friday, 6=Saturday, 7=Sunday'],
'day_name' => ['type' => 'VARCHAR', 'constraint' => 20],
'created_at' => ['type' => 'DATETIME', 'null' => true],
'updated_at' => ['type' => 'DATETIME', 'null' => true],
]);
$this->forge->addKey('id', true);
$this->forge->addUniqueKey('day_number');
$this->forge->createTable('days', true);
}
public function down(): void
{
$this->forge->dropTable('days', true);
}
}