function _update() { $version = freemed::module_version($this->MODULE_NAME); // Version 0.2 // // Migrated to separate table // if (!version_check($version, '0.2')) { // Create table $GLOBALS['sql']->query($GLOBALS['sql']->create_table_query($this->table_name, $this->table_definition, array('id'))); // Migrate old entries $q = $GLOBALS['sql']->queryAll('SELECT ptproblems,id FROM patient WHERE LENGTH(ptproblems) > 3'); foreach ($q as $r) { $e = sql_expand($r['ptproblems']); if (!is_array($e)) { $e = array($e); } foreach ($e as $a) { $GLOBALS['sql']->query($GLOBALS['sql']->insert_query($this->table_name, array('ppatient' => $r['id'], 'problem' => $a))); // end query } // end foreach $e } // end while } }
function _update() { $version = freemed::module_version($this->MODULE_NAME); /* // Example of how to upgrade with ALTER TABLE // Successive instances change the structure of the table // into whatever its current version is, without having // to reload the table at all. This pulls in all of the // changes a version at a time. (You can probably use // REMOVE COLUMN as well, but I'm steering away for now.) if (!version_check($version, '0.1.0')) { $sql->query('ALTER TABLE '.$this->table_name.' '. 'ADD COLUMN ptglucose INT UNSIGNED AFTER id'); } if (!version_check($version, '0.1.1')) { $sql->query('ALTER TABLE '.$this->table_name.' '. 'ADD COLUMN somedescrip TEXT AFTER ptglucose'); } if (!version_check($version, '0.1.3')) { $sql->query('ALTER TABLE '.$this->table_name.' '. 'ADD COLUMN fakefield AFTER ptglucose'); } */ }
function _update() { $version = freemed::module_version($this->MODULE_NAME); // Version 0.3 // // Move phyidmap to be mapped in insco table (inscoidmap) // if (!version_check($version, '0.3')) { $GLOBALS['sql']->query('ALTER TABLE ' . $this->table_name . ' ' . 'ADD COLUMN inscoidmap TEXT AFTER inscomod'); } // Version 0.3.1 // // Add inscodefformat and inscodeftarget mappings // if (!version_check($version, '0.3.4.1')) { $GLOBALS['sql']->query('ALTER TABLE ' . $this->table_name . ' ' . 'ADD COLUMN inscodefformat VARCHAR(50) AFTER inscoidmap'); $GLOBALS['sql']->query('ALTER TABLE ' . $this->table_name . ' ' . 'ADD COLUMN inscodeftarget VARCHAR(50) AFTER inscodefformat'); $GLOBALS['sql']->query('ALTER TABLE ' . $this->table_name . ' ' . 'ADD COLUMN inscodefformate VARCHAR(50) AFTER inscodeftarget'); $GLOBALS['sql']->query('ALTER TABLE ' . $this->table_name . ' ' . 'ADD COLUMN inscodeftargete VARCHAR(50) AFTER inscodefformatE'); } // Version 0.3.3 (Actual update from old module name - HACK) // // Add inscodef{format,target}e for electronic mappings // if ($GLOBALS['sql']->results($GLOBALS['sql']->query("SELECT * FROM module WHERE module_name='Insurance Company Maintenance'"))) { // Remove stale entry $GLOBALS['sql']->query('DELETE FROM module WHERE ' . 'module_name=\'Insurance Company Maintenance\''); // Make changes $GLOBALS['sql']->query('ALTER TABLE ' . $this->table_name . ' ' . 'ADD COLUMN inscodefformat VARCHAR(50) AFTER inscoidmap'); $GLOBALS['sql']->query('ALTER TABLE ' . $this->table_name . ' ' . 'ADD COLUMN inscodeftarget VARCHAR(50) AFTER inscodefformat'); $GLOBALS['sql']->query('ALTER TABLE ' . $this->table_name . ' ' . 'ADD COLUMN inscodefformate VARCHAR(50) AFTER inscodeftarget'); $GLOBALS['sql']->query('ALTER TABLE ' . $this->table_name . ' ' . 'ADD COLUMN inscodeftargete VARCHAR(50) AFTER inscodefformate'); } // Version 0.4 // // Add inscox12id for 837p/remitt // if (!version_check($version, '0.4')) { $GLOBALS['sql']->query('ALTER TABLE ' . $this->table_name . ' ' . 'ADD COLUMN inscox12id VARCHAR(32) AFTER inscoidmap'); $GLOBALS['sql']->query('UPDATE ' . $this->table_name . ' SET inscox12id=\'\' WHERE id>0'); } // Version 0.4.1 // // Add inscodefoutput for remitt // if (!version_check($version, '0.4.1')) { $GLOBALS['sql']->query('ALTER TABLE ' . $this->table_name . ' ' . 'ADD COLUMN inscodefoutput ENUM(\'electronic\', \'paper\') AFTER inscox12id'); $GLOBALS['sql']->query('UPDATE ' . $this->table_name . ' SET inscodefoutput=\'electronic\' WHERE id>0'); } }
function _update() { $version = freemed::module_version($this->MODULE_NAME); // Version 0.7.1 // // Add ability to track events by payment record (clpayrec) // if (!version_check($version, '0.7.1')) { $GLOBALS['sql']->query('ALTER TABLE ' . $this->table_name . ' ' . 'ADD COLUMN clpayrec INT UNSIGNED AFTER clprocedure'); // Set to 0 by default (not associated with any payrec) $GLOBALS['sql']->query('UPDATE ' . $this->table_name . ' ' . 'SET clpayrec=\'0\''); } // Version 0.7.2 // // Force table creation, due to messed up older version // if (!version_check($version, '0.8.2')) { $this->create_table(); } }
function _update() { $version = freemed::module_version($this->MODULE_NAME); // Version 0.1.1 // // Add colors // if (!version_check($version, '0.1.1')) { $GLOBALS['sql']->query('ALTER TABLE ' . $this->table_name . ' ' . 'ADD COLUMN atcolor CHAR(7) AFTER atequipment'); $GLOBALS['sql']->query('UPDATE ' . $this->table_name . ' ' . 'SET atcolor=\'\' WHERE id>0'); } // end version 0.1.1 }
function _update() { global $sql; $version = freemed::module_version($this->MODULE_NAME); //if (!version_check($version, '0.2')) { //} }
function _update() { global $sql; $version = freemed::module_version($this->MODULE_NAME); // Version 0.3 // // Added medicaid resubmission and reference codes // Added outside lab charges // if (!version_check($version, '0.3')) { $sql->query('ALTER TABLE ' . $this->table_name . ' ' . 'ADD COLUMN procmedicaidref VARCHAR(20) AFTER procclmtp'); $sql->query('ALTER TABLE ' . $this->table_name . ' ' . 'ADD COLUMN procmedicaidresub VARCHAR(20) AFTER procmedicaidref'); $sql->query('ALTER TABLE ' . $this->table_name . ' ' . 'ADD COLUMN proclabcharges REAL AFTER procmedicaidresub'); } // Version 0.4 // // Added procedure status (procstatus) // if (!version_check($version, '0.4')) { $sql->query('ALTER TABLE ' . $this->table_name . ' ' . 'ADD COLUMN procstatus INT UNSIGNED AFTER proclabcharges'); } // Version 0.4.1 // // procstatus is now a varchar(50) // if (!version_check($version, '0.4.1')) { $sql->query('ALTER TABLE ' . $this->table_name . ' ' . 'CHANGE COLUMN procstatus ' . 'procstatus VARCHAR(50)'); } // Version 0.4.2 // // add procslidingscale // if (!version_check($version, '0.4.2')) { $sql->query('ALTER TABLE ' . $this->table_name . ' ADD COLUMN procslidingscale CHAR(1)'); $sql->query('UPDATE ' . $this->table_name . ' SET procslidingscale=\'\' WHERE id>0'); } // Version 0.4.3 // // add proctosoverride // if (!version_check($version, '0.4.3')) { $sql->query('ALTER TABLE ' . $this->table_name . ' ADD COLUMN proctosoverride INT UNSIGNED AFTER procslidingscale'); $sql->query('UPDATE ' . $this->table_name . ' SET proctosoverride=0 WHERE id>0'); } // Version 0.5.0 // // add proccptmod{2,3} // if (!version_check($version, '0.5.0')) { $sql->query('ALTER TABLE ' . $this->table_name . ' ADD COLUMN proccptmod2 INT UNSIGNED AFTER proccptmod'); $sql->query('ALTER TABLE ' . $this->table_name . ' ADD COLUMN proccptmod3 INT UNSIGNED AFTER proccptmod2'); $sql->query('UPDATE ' . $this->table_name . ' SET proccptmod2=0,proccptmod3=0 WHERE id>0'); } }