98 lines
5.2 KiB
PHP
98 lines
5.2 KiB
PHP
<?php
|
|
|
|
namespace App\Database\Migrations;
|
|
|
|
use CodeIgniter\Database\Migration;
|
|
|
|
class CreateContactTable extends Migration {
|
|
public function up() {
|
|
// Contact
|
|
$this->forge->addField([
|
|
'ContactID' => [ 'type' => 'INT', 'constraint' => 11, 'unsigned' => true, 'auto_increment' => true ],
|
|
'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 ],
|
|
'EndDate' => [ 'type' => 'DATETIME', 'null' => true ],
|
|
]);
|
|
$this->forge->addField('CreateDate DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP');
|
|
$this->forge->addKey('ContactID', true);
|
|
$this->forge->createTable('contact');
|
|
|
|
// ContactDetail
|
|
$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 ],
|
|
'Code' => [ 'type' => 'varchar', 'constraint' => 11, 'null' => false ],
|
|
'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');
|
|
|
|
// Occupation
|
|
$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 ],
|
|
]);
|
|
$this->forge->addField('CreateDate DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP');
|
|
$this->forge->addKey('OccupationID', true);
|
|
$this->forge->createTable('occupation');
|
|
|
|
/*
|
|
|
|
// ContactTraining
|
|
$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 ],
|
|
]);
|
|
$this->forge->addField('CreateDate DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP');
|
|
// $this->forge->addKey('ContactID', true);
|
|
$this->forge->createTable('ContactTraining');
|
|
|
|
// MedicalSpecialty
|
|
$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 ],
|
|
'EndDate' => [ 'type' => 'DATETIME', 'null' => true ],
|
|
]);
|
|
$this->forge->addField('CreateDate DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP');
|
|
$this->forge->addKey('SpecialtyID', true);
|
|
$this->forge->createTable('MedicalSpecialty');
|
|
|
|
*/
|
|
}
|
|
|
|
public function down() {
|
|
$this->forge->dropTable('Contact');
|
|
$this->forge->dropTable('ContactDetail');
|
|
$this->forge->dropTable('Occupation');
|
|
/*
|
|
$this->forge->dropTable('ContactTraining');
|
|
$this->forge->dropTable('MedicalSpecialty');
|
|
*/
|
|
}
|
|
}
|