Difference between revisions of "Upgrade Mechanism"

From OpenEMR Project Wiki
Line 1: Line 1:
Note this page is for developers to describe the upgrade process. For upgrade instructions go to the [[OpenEMR_Upgrade_Guides|Upgrade OpenEMR]] wiki page.
Note this page is for developers to describe the upgrade process. For upgrade instructions go to the [[OpenEMR_Upgrade_Guides|Upgrade OpenEMR]] wiki page.


Upgrades are done in the following steps:
==Upgrade Steps==
==Replace the codebase==
===Replace the codebase===
:*Simply replace the codebase
:*Simply replace the codebase
:*Migrate over the setting in sites/default(or other name)/sqlconf.php and change $config to 1
:*Migrate over the setting in sites/default(or other name)/sqlconf.php and change $config to 1
Line 11: Line 11:
::*sites/default(or other name)/letter_templates
::*sites/default(or other name)/letter_templates


==Upgrade the database==
===Upgrade the database===
:*This is done via the sql_upgrade.php script
:*This is done via the sql_upgrade.php script
::*This file runs through the database upgrade files (ie. sql/4_1_0-to-4_1_1_upgrade.sql), which contain sql code. Note the sql code is embedded in a meta-language to ensure robust database upgrade. The meta-language is posted below (for examples on use, look through the upgrade sql files):
::*This file runs through the database upgrade files (ie. sql/4_1_0-to-4_1_1_upgrade.sql), which contain sql code. Note the sql code is embedded in a meta-language to ensure robust database upgrade. The meta-language is posted below (for examples on use, look through the upgrade sql files):
Line 60: Line 60:
--    all blocks are terminated with and #EndIf statement.
--    all blocks are terminated with and #EndIf statement.
</pre>
</pre>
==Upgrade the ACL controls==
===Upgrade the ACL controls===
:*This is the acl_upgrade.php script
:*This is the acl_upgrade.php script

Revision as of 22:58, 14 October 2011

Note this page is for developers to describe the upgrade process. For upgrade instructions go to the Upgrade OpenEMR wiki page.

Upgrade Steps

Replace the codebase

  • Simply replace the codebase
  • Migrate over the setting in sites/default(or other name)/sqlconf.php and change $config to 1
  • Keeping several of the folders that store documents.
  • sites/default(or other name)/documents
  • sites/default(or other name)/edi
  • sites/default(or other name)/era
  • sites/default(or other name)/letter_templates

Upgrade the database

  • This is done via the sql_upgrade.php script
  • This file runs through the database upgrade files (ie. sql/4_1_0-to-4_1_1_upgrade.sql), which contain sql code. Note the sql code is embedded in a meta-language to ensure robust database upgrade. The meta-language is posted below (for examples on use, look through the upgrade sql files):
--
--  Comment Meta Language Constructs:
--
--  #IfNotTable
--    argument: table_name
--    behavior: if the table_name does not exist,  the block will be executed

--  #IfTable
--    argument: table_name
--    behavior: if the table_name does exist, the block will be executed

--  #IfMissingColumn
--    arguments: table_name colname
--    behavior:  if the colname in the table_name table does not exist,  the block will be executed

--  #IfNotColumnType
--    arguments: table_name colname value
--    behavior:  If the table table_name does not have a column colname with a data type equal to value, then the block will be executed

--  #IfNotRow
--    arguments: table_name colname value
--    behavior:  If the table table_name does not have a row where colname = value, the block will be executed.

--  #IfNotRow2D
--    arguments: table_name colname value colname2 value2
--    behavior:  If the table table_name does not have a row where colname = value AND colname2 = value2, the block will be executed.

--  #IfNotRow3D
--    arguments: table_name colname value colname2 value2 colname3 value3
--    behavior:  If the table table_name does not have a row where colname = value AND colname2 = value2 AND colname3 = value3, the block will be executed.

--  #IfNotRow4D
--    arguments: table_name colname value colname2 value2 colname3 value3 colname4 value4
--    behavior:  If the table table_name does not have a row where colname = value AND colname2 = value2 AND colname3 = value3 AND colname4 = value4, the block will be executed.

--  #IfNotRow2Dx2
--    desc:      This is a very specialized function to allow adding items to the list_options table to avoid both redundant option_id and title in each element.
--    arguments: table_name colname value colname2 value2 colname3 value3
--    behavior:  The block will be executed if both statements below are true:
--               1) The table table_name does not have a row where colname = value AND colname2 = value2.
--               2) The table table_name does not have a row where colname = value AND colname3 = value3.

--  #EndIf
--    all blocks are terminated with and #EndIf statement.

Upgrade the ACL controls

  • This is the acl_upgrade.php script