2 -- Comment Meta Language Constructs:
5 -- argument: table_name
6 -- behavior: if the table_name does not exist, the block will be executed
9 -- argument: table_name
10 -- behavior: if the table_name does exist, the block will be executed
13 -- arguments: table_name colname
14 -- behavior: if the table and column exist, the block will be executed
17 -- arguments: table_name colname
18 -- behavior: if the table exists but the column does not, the block will be executed
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
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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
78 -- all blocks are terminated with a #EndIf statement.
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.
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.
98 -- behavior: can take a long time.
100 -- #IfDocumentNamingNeeded
101 -- desc: populate name field with document names.
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.
112 #IfMissingColumn form_encounter last_update
113 ALTER TABLE `form_encounter` ADD `last_update` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
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');
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';