Commit generated changelog for 7.0.2.1 (#7458)
[openemr.git] / sql / 7_0_2-to-7_0_3_upgrade.sql
blob014a1c97d9704f5e7a28dda52cfa426be90270bc
1 --
2 --  Comment Meta Language Constructs:
3 --
4 --  #IfNotTable
5 --    argument: table_name
6 --    behavior: if the table_name does not exist,  the block will be executed
8 --  #IfTable
9 --    argument: table_name
10 --    behavior: if the table_name does exist, the block will be executed
12 --  #IfColumn
13 --    arguments: table_name colname
14 --    behavior:  if the table and column exist,  the block will be executed
16 --  #IfMissingColumn
17 --    arguments: table_name colname
18 --    behavior:  if the table exists but the column does not,  the block will be executed
20 --  #IfNotColumnType
21 --    arguments: table_name colname value
22 --    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
24 --  #IfNotColumnTypeDefault
25 --    arguments: table_name colname value value2
26 --    behavior:  If the table table_name does not have a column colname with a data type equal to value and a default equal to value2, then the block will be executed
28 --  #IfNotRow
29 --    arguments: table_name colname value
30 --    behavior:  If the table table_name does not have a row where colname = value, the block will be executed.
32 --  #IfNotRow2D
33 --    arguments: table_name colname value colname2 value2
34 --    behavior:  If the table table_name does not have a row where colname = value AND colname2 = value2, the block will be executed.
36 --  #IfNotRow3D
37 --    arguments: table_name colname value colname2 value2 colname3 value3
38 --    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.
40 --  #IfNotRow4D
41 --    arguments: table_name colname value colname2 value2 colname3 value3 colname4 value4
42 --    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.
44 --  #IfNotRow2Dx2
45 --    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.
46 --    arguments: table_name colname value colname2 value2 colname3 value3
47 --    behavior:  The block will be executed if both statements below are true:
48 --               1) The table table_name does not have a row where colname = value AND colname2 = value2.
49 --               2) The table table_name does not have a row where colname = value AND colname3 = value3.
51 --  #IfRow
52 --    arguments: table_name colname value
53 --    behavior:  If the table table_name does have a row where colname = value, the block will be executed.
55 --  #IfRow2D
56 --    arguments: table_name colname value colname2 value2
57 --    behavior:  If the table table_name does have a row where colname = value AND colname2 = value2, the block will be executed.
59 --  #IfRow3D
60 --        arguments: table_name colname value colname2 value2 colname3 value3
61 --        behavior:  If the table table_name does have a row where colname = value AND colname2 = value2 AND colname3 = value3, the block will be executed.
63 --  #IfRowIsNull
64 --    arguments: table_name colname
65 --    behavior:  If the table table_name does have a row where colname is null, the block will be executed.
67 --  #IfIndex
68 --    desc:      This function is most often used for dropping of indexes/keys.
69 --    arguments: table_name colname
70 --    behavior:  If the table and index exist the relevant statements are executed, otherwise not.
72 --  #IfNotIndex
73 --    desc:      This function will allow adding of indexes/keys.
74 --    arguments: table_name colname
75 --    behavior:  If the index does not exist, it will be created
77 --  #EndIf
78 --    all blocks are terminated with a #EndIf statement.
80 --  #IfNotListReaction
81 --    Custom function for creating Reaction List
83 --  #IfNotListOccupation
84 --    Custom function for creating Occupation List
86 --  #IfTextNullFixNeeded
87 --    desc: convert all text fields without default null to have default null.
88 --    arguments: none
90 --  #IfTableEngine
91 --    desc:      Execute SQL if the table has been created with given engine specified.
92 --    arguments: table_name engine
93 --    behavior:  Use when engine conversion requires more than one ALTER TABLE
95 --  #IfInnoDBMigrationNeeded
96 --    desc: find all MyISAM tables and convert them to InnoDB.
97 --    arguments: none
98 --    behavior: can take a long time.
100 --  #IfDocumentNamingNeeded
101 --    desc: populate name field with document names.
102 --    arguments: none
104 --  #IfUpdateEditOptionsNeeded
105 --    desc: Change Layout edit options.
106 --    arguments: mode(add or remove) layout_form_id the_edit_option comma_separated_list_of_field_ids
108 --  #IfVitalsDatesNeeded
109 --    desc: Change date from zeroes to date of vitals form creation.
110 --    arguments: none
112 #IfMissingColumn form_encounter last_update
113 ALTER TABLE `form_encounter` ADD `last_update` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
114 #EndIf
116 #IfNotRow4D supported_external_dataloads load_type CQM_VALUESET load_source NIH_VSAC load_release_date 2023-05-04 load_filename ec_only_cms_20230504.xml.zip
117 INSERT INTO `supported_external_dataloads` (`load_type`, `load_source`, `load_release_date`, `load_filename`, `load_checksum`) VALUES
118 ('CQM_VALUESET', 'NIH_VSAC', '2023-05-04', 'ec_only_cms_20230504.xml.zip', 'b77b3c2a88d23de0ec427c1cfc5088ce');
119 #EndIf
121 #IfMissingColumn form_encounter ordering_provider_id
122 ALTER TABLE `form_encounter` ADD `ordering_provider_id` INT(11) DEFAULT '0' COMMENT 'ordering provider, if any, for this visit';
123 #EndIf