forge->addField([ 'SiteID' => ['type' => 'INT', 'constraint' => 11, 'null' => true], 'InternalPVID'=> ['type' => 'INT', 'constraint' => 11, 'unsigned' => true, 'auto_increment' => true], 'PVID' => ['type' => 'VARCHAR', 'constraint' => 20, 'null' => true], 'InternalPID' => ['type' => 'INT', 'constraint' => 11, 'null' => true], 'EpisodeID' => ['type' => 'VARCHAR', 'constraint' => 255, 'null' => true], 'LastVisitADT' => ['type' => 'VARCHAR', 'constraint' => 5, 'null' => true], 'CreateDate' => ['type' => 'DATETIME', 'null' => true], 'EndDate' => ['type' => 'DATETIME', 'null' => true], 'ArchivedDate'=> ['type' => 'DATETIME', 'null' => true], 'DelDate' => ['type' => 'DATETIME', 'null' => true], ]); $this->forge->addKey('InternalPVID', true); $this->forge->addUniqueKey('PVID'); $this->forge->createTable('patvisit'); $this->forge->addField([ 'InternalPVID' => ['type' => 'INT', 'constraint' => 11], 'InternalPID' => ['type' => 'INT', 'constraint' => 11, 'null' => true], 'DiagCode' => ['type' => 'VARCHAR', 'constraint' => 255, 'null' => true], 'Diagnosis' => ['type' => 'TEXT', 'null' => true], 'CreateDate' => ['type' => 'DATETIME', 'null' => true], 'EndDate' => ['type' => 'DATETIME', 'null' => true], 'ArchivedDate' => ['type' => 'DATETIME', 'null' => true], 'DelDate' => ['type' => 'DATETIME', 'null' => true], ]); $this->forge->addKey('InternalPVID', true); $this->forge->createTable('patdiag'); $this->forge->addField([ 'PVADTID' => ['type' => 'INT', 'unsigned' => true, 'auto_increment' => true], 'InternalPVID'=> ['type' => 'INT', 'null' => true], 'ADTCode' => ['type' => 'VARCHAR', 'constraint' => 255, 'null' => true], 'LocationID' => ['type' => 'INT', 'constraint' => 11, 'null' => true], 'AttDoc' => ['type' => 'INT', 'constraint' => 11, 'null' => true], 'RefDoc' => ['type' => 'INT', 'constraint' => 11, 'null' => true], 'AdmDoc' => ['type' => 'INT', 'constraint' => 11, 'null' => true], 'CnsDoc' => ['type' => 'INT', 'constraint' => 11, 'null' => true], 'CreateDate' => ['type' => 'DATETIME', 'null' => true], 'EndDate' => ['type' => 'DATETIME', 'null' => true], 'ArchivedDate'=> ['type' => 'DATETIME', 'null' => true], 'DelDate' => ['type' => 'DATETIME', 'null' => true], ]); $this->forge->addKey('PVADTID', true); $this->forge->createTable('patvisitadt'); } public function down() { $this->forge->dropTable('patvisitadt'); $this->forge->dropTable('patdiag'); $this->forge->dropTable('patvisit'); } }