Update Migrations Doctor

This commit is contained in:
mikael-zakaria 2025-09-12 11:27:54 +07:00
parent 520cc443cc
commit 5d4ab01b28

View File

@ -0,0 +1,92 @@
<?php
namespace App\Database\Migrations;
use CodeIgniter\Database\Migration;
class DoctorMaster extends Migration
{
public function up() {
// Occupation 1
$this->forge->addField([
'OccupationID' => [ 'type' => 'INT', 'constraint' => 11, 'auto_increment' => true],
'AbbTex' => [ 'type' => 'VARCHAR', 'constraint' => 5, 'null' => true ],
'FullText' => [ 'type' => 'VARCHAR', 'constraint' => 255, 'null' => true ],
'Description' => [ 'type' => 'TEXT', 'null' => true ],
'CreateDate' => [ 'type' => 'DATETIME'],
]);
$this->forge->addKey('OccupationID', true);
$this->forge->createTable('Occupation');
// Contact 2
$this->forge->addField([
'ContactID' => [ 'type' => 'INT', 'constraint' => 11 ],
'NameFirst' => [ 'type' => 'VARCHAR', 'constraint' => 100, 'null' => true ],
'NameLast' => [ 'type' => 'VARCHAR', 'constraint' => 100, 'null' => true ],
'Title' => [ 'type' => 'VARCHAR', 'constraint' => 50, 'null' => true ],
'Initial' => [ 'type' => 'VARCHAR', 'constraint' => 10, 'null' => true ],
'Birthdate' => [ 'type' => 'DATE', 'null' => true ],
'EmailAddress1' => [ 'type' => 'VARCHAR', 'constraint' => 150, 'null' => true ],
'EmailAddress2' => [ 'type' => 'VARCHAR', 'constraint' => 150, 'null' => true ],
'Phone' => [ 'type' => 'VARCHAR', 'constraint' => 50, 'null' => true ],
'MobilePhone1' => [ 'type' => 'VARCHAR', 'constraint' => 50, 'null' => true ],
'MobilePhone2' => [ 'type' => 'VARCHAR', 'constraint' => 50, 'null' => true ],
'Specialty' => [ 'type' => 'VARCHAR', 'constraint' => 100, 'null' => true ],
'SubSpecialty' => [ 'type' => 'VARCHAR', 'constraint' => 100, 'null' => true ],
'CreateDate' => [ 'type' => 'DATETIME'],
'EndDate' => [ 'type' => 'DATETIME', 'null' => true ],
]);
$this->forge->addKey('ContactID', true);
$this->forge->createTable('Contact');
// ContactDetail 3
$this->forge->addField([
'ContactDetID' => [ 'type' => 'INT', 'constraint' => 11, 'unsigned' => true, 'auto_increment' => true ],
'ContactID' => [ 'type' => 'INT', 'constraint' => 11 ],
'SiteID' => [ 'type' => 'INT', 'constraint' => 11, 'null' => true ],
'ContactEmail' => [ 'type' => 'VARCHAR', 'constraint' => 150, 'null' => true ],
'OccupationID' => [ 'type' => 'VARCHAR', 'constraint' => 50, 'null' => true ],
'JobTitle' => [ 'type' => 'VARCHAR', 'constraint' => 100, 'null' => true ],
'Department' => [ 'type' => 'VARCHAR', 'constraint' => 100, 'null' => true ],
'ContactStartDate' => [ 'type' => 'DATE', 'null' => true ],
'ContactEndDate' => [ 'type' => 'DATE', 'null' => true ],
]);
$this->forge->addKey('ContactDetID', true);
$this->forge->createTable('ContactDetail');
// ContactTraining 4
$this->forge->addField([
'ContactID' => [ 'type' => 'INT', 'constraint' => 11 ],
'TrainingType' => [ 'type' => 'VARCHAR', 'constraint' => 50, 'null' => true ],
'TrainingTitle' => [ 'type' => 'VARCHAR', 'constraint' => 255, 'null' => true ],
'StartDate' => [ 'type' => 'DATETIME', 'null' => true ],
'EndDate' => [ 'type' => 'DATETIME', 'null' => true ],
'Facilitator' => [ 'type' => 'VARCHAR', 'constraint' => 150, 'null' => true ],
'CertificateLocation'=> [ 'type' => 'VARCHAR', 'constraint' => 255, 'null' => true ],
'CreateDate' => [ 'type' => 'DATETIME'],
]);
// $this->forge->addKey('ContactID', true);
$this->forge->createTable('ContactTraining');
// MedicalSpecialty 5
$this->forge->addField([
'SpecialtyID' => [ 'type' => 'INT', 'constraint' => 11 ],
'SpecialtyText' => [ 'type' => 'VARCHAR', 'constraint' => 255, 'null' => true ],
'Parent' => [ 'type' => 'VARCHAR', 'constraint' => 50, 'null' => true ],
'Title' => [ 'type' => 'VARCHAR', 'constraint' => 50, 'null' => true ],
'CreateDate' => [ 'type' => 'DATETIME'],
'EndDate' => [ 'type' => 'DATETIME', 'null' => true ],
]);
$this->forge->addKey('SpecialtyID', true);
$this->forge->createTable('MedicalSpecialty');
}
public function down() {
$this->forge->dropTable('Occupation');
$this->forge->dropTable('Contact');
$this->forge->dropTable('ContactDetail');
$this->forge->dropTable('ContactTraining');
$this->forge->dropTable('MedicalSpecialty');
}
}