forge->addField([ 'id' => ['type' => 'INT', 'unsigned' => true, 'auto_increment' => true], 'first_name' => ['type' => 'VARCHAR', 'constraint' => 50, 'null' => true], 'last_name' => ['type' => 'VARCHAR', 'constraint' => 50, 'null' => true], 'email' => ['type' => 'VARCHAR', 'constraint' => 191], 'password' => ['type' => 'VARCHAR', 'constraint' => 255], 'role' => ['type' => 'VARCHAR', 'constraint' => 20], 'status' => ['type' => 'VARCHAR', 'constraint' => 20, 'null' => true], ]); $this->forge->addKey('id', true); $this->forge->addUniqueKey('email'); $this->forge->createTable('users', true); $this->forge->addField([ 'id' => ['type' => 'INT', 'unsigned' => true, 'auto_increment' => true], 'user_id' => ['type' => 'INT', 'unsigned' => true], 'specialization' => ['type' => 'VARCHAR', 'constraint' => 191, 'null' => true], 'experience' => ['type' => 'VARCHAR', 'constraint' => 100, 'null' => true], 'fees' => ['type' => 'DECIMAL', 'constraint' => '10,2', 'null' => true], 'available_from' => ['type' => 'TIME', 'null' => true], 'available_to' => ['type' => 'TIME', 'null' => true], ]); $this->forge->addKey('id', true); $this->forge->addKey('user_id'); $this->forge->createTable('doctors', true); $this->forge->addField([ 'id' => ['type' => 'INT', 'unsigned' => true, 'auto_increment' => true], 'user_id' => ['type' => 'INT', 'unsigned' => true], 'age' => ['type' => 'INT', 'null' => true], 'gender' => ['type' => 'VARCHAR', 'constraint' => 20, 'null' => true], 'phone' => ['type' => 'VARCHAR', 'constraint' => 30, 'null' => true], ]); $this->forge->addKey('id', true); $this->forge->addKey('user_id'); $this->forge->createTable('patients', true); $this->forge->addField([ 'id' => ['type' => 'INT', 'unsigned' => true, 'auto_increment' => true], 'patient_id' => ['type' => 'INT', 'unsigned' => true], 'doctor_id' => ['type' => 'INT', 'unsigned' => true], 'appointment_date' => ['type' => 'DATE'], 'appointment_time' => ['type' => 'TIME'], 'status' => ['type' => 'ENUM', 'constraint' => ['pending', 'approved', 'rejected'], 'default' => 'pending'], ]); $this->forge->addKey('id', true); $this->forge->addKey(['doctor_id', 'appointment_date', 'appointment_time']); $this->forge->addKey('patient_id'); $this->forge->createTable('appointments', true); } public function down(): void { $this->forge->dropTable('appointments', true); $this->forge->dropTable('patients', true); $this->forge->dropTable('doctors', true); $this->forge->dropTable('users', true); } }