Financial summary by service code report
[openemr.git] / sql / 4_1_0-to-4_1_1_upgrade.sql
blob96ca9dd32fce923f94e4476483159a0544d236ac
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 --  #IfMissingColumn
13 --    arguments: table_name colname
14 --    behavior:  if the table exists but the column does not,  the block will be executed
16 --  #IfNotColumnType
17 --    arguments: table_name colname value
18 --    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
20 --  #IfNotRow
21 --    arguments: table_name colname value
22 --    behavior:  If the table table_name does not have a row where colname = value, the block will be executed.
24 --  #IfNotRow2D
25 --    arguments: table_name colname value colname2 value2
26 --    behavior:  If the table table_name does not have a row where colname = value AND colname2 = value2, the block will be executed.
28 --  #IfNotRow3D
29 --    arguments: table_name colname value colname2 value2 colname3 value3
30 --    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.
32 --  #IfNotRow4D
33 --    arguments: table_name colname value colname2 value2 colname3 value3 colname4 value4
34 --    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.
36 --  #IfNotRow2Dx2
37 --    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.
38 --    arguments: table_name colname value colname2 value2 colname3 value3
39 --    behavior:  The block will be executed if both statements below are true:
40 --               1) The table table_name does not have a row where colname = value AND colname2 = value2.
41 --               2) The table table_name does not have a row where colname = value AND colname3 = value3.
43 --  #IfRow2D
44 --    arguments: table_name colname value colname2 value2
45 --    behavior:  If the table table_name does have a row where colname = value AND colname2 = value2, the block will be executed.
47 --  #IfIndex
48 --    desc:      This function is most often used for dropping of indexes/keys.
49 --    arguments: table_name colname
50 --    behavior:  If the table and index exist the relevant statements are executed, otherwise not.
52 --  #IfNotIndex
53 --    desc:      This function will allow adding of indexes/keys.
54 --    arguments: table_name colname
55 --    behavior:  If the index does not exist, it will be created
57 --  #EndIf
58 --    all blocks are terminated with a #EndIf statement.
61 #IfNotIndex lists type
62 CREATE INDEX `type` ON `lists` (`type`);
63 #EndIf
65 #IfNotIndex lists pid
66 CREATE INDEX `pid` ON `lists` (`pid`);
67 #EndIf
69 #IfNotIndex form_vitals pid
70 CREATE INDEX `pid` ON `form_vitals` (`pid`);
71 #EndIf
73 #IfIndex forms pid
74 DROP INDEX `pid` ON `forms`;
75 #EndIf
77 #IfIndex form_encounter pid
78 DROP INDEX `pid` ON `form_encounter`;
79 #EndIf
81 #IfNotIndex forms pid_encounter
82 CREATE INDEX `pid_encounter` ON `forms` (`pid`, `encounter`);
83 #EndIf
85 #IfNotIndex form_encounter pid_encounter
86 CREATE INDEX `pid_encounter` ON `form_encounter` (`pid`, `encounter`);
87 #EndIf
89 #IfNotIndex immunizations patient_id
90 CREATE INDEX `patient_id` ON `immunizations` (`patient_id`);
91 #EndIf
93 #IfNotIndex procedure_order patient_id
94 CREATE INDEX `patient_id` ON `procedure_order` (`patient_id`);
95 #EndIf
97 #IfNotIndex pnotes pid
98 CREATE INDEX `pid` ON `pnotes` (`pid`);
99 #EndIf
101 #IfNotIndex transactions pid
102 CREATE INDEX `pid` ON `transactions` (`pid`);
103 #EndIf
105 #IfNotIndex extended_log patient_id
106 CREATE INDEX `patient_id` ON `extended_log` (`patient_id`);
107 #EndIf
109 #IfNotIndex prescriptions patient_id
110 CREATE INDEX `patient_id` ON `prescriptions` (`patient_id`);
111 #EndIf
113 #IfNotIndex openemr_postcalendar_events pc_eventDate
114 CREATE INDEX `pc_eventDate` ON `openemr_postcalendar_events` (`pc_eventDate`);
115 #EndIf
117 #IfMissingColumn version v_realpatch
118 ALTER TABLE `version` ADD COLUMN `v_realpatch` int(11) NOT NULL DEFAULT 0;
119 #EndIf
121 #IfMissingColumn prescriptions drug_info_erx
122 ALTER TABLE `prescriptions` ADD COLUMN `drug_info_erx` TEXT DEFAULT NULL;
123 #EndIf
125 #IfNotRow2D list_options list_id lists option_id nation_notes_replace_buttons
126 INSERT INTO `list_options` (`list_id`, `option_id`, `title`, `seq`) VALUES ('lists','nation_notes_replace_buttons','Nation Notes Replace Buttons',1);
127 INSERT INTO `list_options` (`list_id`, `option_id`, `title`, `seq`) VALUES ('nation_notes_replace_buttons','Yes','Yes',10);
128 INSERT INTO `list_options` (`list_id`, `option_id`, `title`, `seq`) VALUES ('nation_notes_replace_buttons','No','No',20);
129 INSERT INTO `list_options` (`list_id`, `option_id`, `title`, `seq`) VALUES ('nation_notes_replace_buttons','Normal','Normal',30);
130 INSERT INTO `list_options` (`list_id`, `option_id`, `title`, `seq`) VALUES ('nation_notes_replace_buttons','Abnormal','Abnormal',40);
131 #EndIf
133 #IfMissingColumn insurance_data policy_type
134 ALTER TABLE `insurance_data` ADD COLUMN `policy_type` varchar(25) NOT NULL default '';
135 #EndIf
137 #IfMissingColumn drugs max_level
138 ALTER TABLE drugs ADD max_level float NOT NULL DEFAULT 0.0;
139 ALTER TABLE drugs CHANGE reorder_point reorder_point float NOT NULL DEFAULT 0.0;
140 #EndIf
142 #IfNotTable product_warehouse
143 CREATE TABLE `product_warehouse` (
144   `pw_drug_id`   int(11) NOT NULL,
145   `pw_warehouse` varchar(31) NOT NULL,
146   `pw_min_level` float       DEFAULT 0,
147   `pw_max_level` float       DEFAULT 0,
148   PRIMARY KEY  (`pw_drug_id`,`pw_warehouse`)
149 ) ENGINE=MyISAM;
150 #EndIf
152 #IfNotColumnType billing modifier varchar(12)
153    ALTER TABLE `billing` MODIFY `modifier` varchar(12);
154    UPDATE `code_types` SET `ct_mod` = '12' where ct_key = 'CPT4' OR ct_key = 'HCPCS';
155 #Endif
157 #IfMissingColumn billing notecodes
158 ALTER TABLE `billing` ADD `notecodes` varchar(25) NOT NULL default '';
159 #EndIf
161 #IfNotTable dated_reminders
162 CREATE TABLE `dated_reminders` (
163             `dr_id` int(11) NOT NULL AUTO_INCREMENT,
164             `dr_from_ID` int(11) NOT NULL,
165             `dr_message_text` varchar(160) NOT NULL,
166             `dr_message_sent_date` datetime NOT NULL,
167             `dr_message_due_date` date NOT NULL,
168             `pid` int(11) NOT NULL,
169             `message_priority` tinyint(1) NOT NULL,
170             `message_processed` tinyint(1) NOT NULL DEFAULT '0',
171             `processed_date` timestamp NULL DEFAULT NULL,
172             `dr_processed_by` int(11) NOT NULL,
173             PRIMARY KEY (`dr_id`),
174             KEY `dr_from_ID` (`dr_from_ID`,`dr_message_due_date`)
175           ) ENGINE=MyISAM AUTO_INCREMENT=1;
176 #EndIf
178 #IfNotTable dated_reminders_link
179 CREATE TABLE `dated_reminders_link` (
180             `dr_link_id` int(11) NOT NULL AUTO_INCREMENT,
181             `dr_id` int(11) NOT NULL,
182             `to_id` int(11) NOT NULL,
183             PRIMARY KEY (`dr_link_id`),
184             KEY `to_id` (`to_id`),
185             KEY `dr_id` (`dr_id`)
186           ) ENGINE=MyISAM AUTO_INCREMENT=1;
187 #EndIf
189 #IfMissingColumn x12_partners x12_gs03
190 ALTER TABLE `x12_partners` ADD COLUMN `x12_gs03` VARCHAR(15) NOT NULL DEFAULT '';
191 #EndIf
193 #IfNotTable payment_gateway_details
194 CREATE TABLE `payment_gateway_details` (
195   `id` int(11) NOT NULL AUTO_INCREMENT,
196   `service_name` varchar(100) DEFAULT NULL,
197   `login_id` varchar(255) DEFAULT NULL,
198   `transaction_key` varchar(255) DEFAULT NULL,
199   `md5` varchar(255) DEFAULT NULL,
200   PRIMARY KEY (`id`)
201 ) ENGINE=InnoDB;
202 #EndIf
204 #IfNotRow2D list_options list_id lists option_id payment_gateways
205 insert into `list_options` (`list_id`, `option_id`, `title`, `seq`, `is_default`, `option_value`, `mapping`, `notes`) values('lists','payment_gateways','Payment Gateways','297','1','0','','');
206 insert into `list_options` (`list_id`, `option_id`, `title`, `seq`, `is_default`, `option_value`, `mapping`, `notes`) values('payment_gateways','authorize_net','Authorize.net','1','0','0','','');
207 #EndIf
209 #IfNotRow2D list_options list_id payment_method option_id authorize_net
210 insert into `list_options` (`list_id`, `option_id`, `title`, `seq`, `is_default`, `option_value`, `mapping`, `notes`) values('payment_method','authorize_net','Authorize.net','60','0','0','','');
211 #EndIf
213 #IfMissingColumn patient_access_offsite authorize_net_id
214 ALTER TABLE `patient_access_offsite` ADD COLUMN `authorize_net_id` VARCHAR(20) COMMENT 'authorize.net profile id';
215 #EndIf
217 #IfMissingColumn facility website
218 ALTER TABLE `facility` ADD COLUMN `website` varchar(255) default NULL;
219 #EndIf
221 #IfMissingColumn facility email
222 ALTER TABLE `facility` ADD COLUMN `email` varchar(255) default NULL;
223 #EndIf
225 #IfMissingColumn code_types ct_active
226 ALTER TABLE `code_types` ADD COLUMN `ct_active` tinyint(1) NOT NULL default 1 COMMENT '1 if this is active';
227 #EndIf
229 #IfMissingColumn code_types ct_label
230 ALTER TABLE `code_types` ADD COLUMN `ct_label` varchar(31) NOT NULL default '' COMMENT 'label of this code type';
231 UPDATE `code_types` SET ct_label = ct_key;
232 #EndIf
234 #IfMissingColumn code_types ct_external
235 ALTER TABLE `code_types` ADD COLUMN `ct_external` tinyint(1) NOT NULL default 0 COMMENT '0 if stored codes in codes tables, 1 or greater if codes stored in external tables';
236 #EndIf
238 #IfNotRow code_types ct_key DSMIV
239 DROP TABLE IF EXISTS `temp_table_one`;
240 CREATE TABLE `temp_table_one` (
241   `id` int(11) NOT NULL DEFAULT '0',
242   `seq` int(11) NOT NULL DEFAULT '0'
243 ) ENGINE=MyISAM ;
244 INSERT INTO `temp_table_one` (`id`, `seq`) VALUES ( IF( ((SELECT MAX(`ct_id`) FROM `code_types`)>=100), ((SELECT MAX(`ct_id`) FROM `code_types`) + 1), 100 ) , IF( ((SELECT MAX(`ct_seq`) FROM `code_types`)>=100), ((SELECT MAX(`ct_seq`) FROM `code_types`) + 1), 100 )  );
245 INSERT INTO code_types (ct_key, ct_id, ct_seq, ct_mod, ct_just, ct_fee, ct_rel, ct_nofs, ct_diag, ct_active, ct_label, ct_external ) VALUES ('DSMIV' , (SELECT MAX(`id`) FROM `temp_table_one`), (SELECT MAX(`seq`) FROM `temp_table_one`), 2, '', 0, 0, 0, 1, 0, 'DSMIV', 0);
246 DROP TABLE `temp_table_one`;
247 #EndIf
249 #IfNotRow code_types ct_key ICD10
250 DROP TABLE IF EXISTS `temp_table_one`;
251 CREATE TABLE `temp_table_one` (
252   `id` int(11) NOT NULL DEFAULT '0',
253   `seq` int(11) NOT NULL DEFAULT '0'
254 ) ENGINE=MyISAM ;
255 INSERT INTO `temp_table_one` (`id`, `seq`) VALUES ( IF( ((SELECT MAX(`ct_id`) FROM `code_types`)>=100), ((SELECT MAX(`ct_id`) FROM `code_types`) + 1), 100 ) , IF( ((SELECT MAX(`ct_seq`) FROM `code_types`)>=100), ((SELECT MAX(`ct_seq`) FROM `code_types`) + 1), 100 )  );
256 INSERT INTO code_types (ct_key, ct_id, ct_seq, ct_mod, ct_just, ct_fee, ct_rel, ct_nofs, ct_diag, ct_active, ct_label, ct_external ) VALUES ('ICD10' , (SELECT MAX(`id`) FROM `temp_table_one`), (SELECT MAX(`seq`) FROM `temp_table_one`), 2, '', 0, 0, 0, 1, 0, 'ICD10', 1);
257 DROP TABLE `temp_table_one`;
258 #EndIf
260 #IfNotRow code_types ct_key SNOMED
261 DROP TABLE IF EXISTS `temp_table_one`;
262 CREATE TABLE `temp_table_one` (
263   `id` int(11) NOT NULL DEFAULT '0',
264   `seq` int(11) NOT NULL DEFAULT '0'
265 ) ENGINE=MyISAM ;
266 INSERT INTO `temp_table_one` (`id`, `seq`) VALUES ( IF( ((SELECT MAX(`ct_id`) FROM `code_types`)>=100), ((SELECT MAX(`ct_id`) FROM `code_types`) + 1), 100 ) , IF( ((SELECT MAX(`ct_seq`) FROM `code_types`)>=100), ((SELECT MAX(`ct_seq`) FROM `code_types`) + 1), 100 )  );
267 INSERT INTO code_types (ct_key, ct_id, ct_seq, ct_mod, ct_just, ct_fee, ct_rel, ct_nofs, ct_diag, ct_active, ct_label, ct_external ) VALUES ('SNOMED' , (SELECT MAX(`id`) FROM `temp_table_one`), (SELECT MAX(`seq`) FROM `temp_table_one`), 2, '', 0, 0, 0, 1, 0, 'SNOMED', 2);
268 DROP TABLE `temp_table_one`;
269 #EndIf
271 #IfRow2D billing code_type COPAY activity 1
272 DROP TABLE IF EXISTS `temp_table_one`;
273 CREATE TABLE `temp_table_one` (
274   id             int unsigned  NOT NULL AUTO_INCREMENT,
275   session_id     int unsigned  NOT NULL,
276   payer_id       int(11)       NOT NULL DEFAULT 0,
277   user_id        int(11)       NOT NULL,
278   pay_total      decimal(12,2) NOT NULL DEFAULT 0,
279   payment_type varchar( 50 ) NOT NULL DEFAULT 'patient',
280   description text NOT NULL,
281   adjustment_code varchar( 50 ) NOT NULL DEFAULT 'patient_payment',
282   post_to_date date NOT NULL,
283   patient_id int( 11 ) NOT NULL,
284   payment_method varchar( 25 ) NOT NULL DEFAULT 'cash',
285   pid            int(11)       NOT NULL,
286   encounter      int(11)       NOT NULL,
287   code           varchar(9)    NOT NULL,
288   modifier       varchar(5)    NOT NULL DEFAULT '',
289   payer_type     int           NOT NULL DEFAULT 0,
290   post_time      datetime      NOT NULL,
291   post_user      int(11)       NOT NULL,
292   pay_amount     decimal(12,2) NOT NULL DEFAULT 0,
293   account_code varchar(15) NOT NULL DEFAULT 'PCP',
294   PRIMARY KEY (id)
295 ) ENGINE=MyISAM AUTO_INCREMENT=1;
296 INSERT INTO `temp_table_one` (`user_id`, `pay_total`, `patient_id`, `post_to_date`, `pid`, `encounter`, `post_time`, `post_user`, `pay_amount`, `description`) SELECT `user`, (`fee`*-1), `pid`, `date`, `pid`, `encounter`, `date`, `user`, (`fee`*-1), 'COPAY' FROM `billing` WHERE `code_type`='COPAY' AND `activity`!=0;
297 UPDATE `temp_table_one` SET `session_id`= ((SELECT MAX(session_id) FROM ar_session)+`id`);
298 UPDATE `billing`, `code_types`, `temp_table_one` SET temp_table_one.code=billing.code, temp_table_one.modifier=billing.modifier WHERE billing.code_type=code_types.ct_key AND code_types.ct_fee=1 AND temp_table_one.pid=billing.pid AND temp_table_one.encounter=billing.encounter AND billing.activity!=0;
299 INSERT INTO `ar_session` (`payer_id`, `user_id`, `pay_total`, `payment_type`, `description`, `patient_id`, `payment_method`, `adjustment_code`, `post_to_date`) SELECT `payer_id`, `user_id`, `pay_total`, `payment_type`, `description`, `patient_id`, `payment_method`, `adjustment_code`, `post_to_date` FROM `temp_table_one`;
300 INSERT INTO `ar_activity` (`pid`, `encounter`, `code`, `modifier`, `payer_type`, `post_time`, `post_user`, `session_id`, `pay_amount`, `account_code`) SELECT `pid`, `encounter`, `code`, `modifier`, `payer_type`, `post_time`, `post_user`, `session_id`, `pay_amount`, `account_code` FROM `temp_table_one`;
301 UPDATE `billing` SET `activity`=0 WHERE `code_type`='COPAY';
302 DROP TABLE IF EXISTS `temp_table_one`;
303 #EndIf
305 #IfNotTable facility_user_ids
306 CREATE TABLE  `facility_user_ids` (
307   `id` bigint(20) NOT NULL AUTO_INCREMENT,
308   `uid` bigint(20) DEFAULT NULL,
309   `facility_id` bigint(20) DEFAULT NULL,
310   `field_id`    varchar(31)  NOT NULL COMMENT 'references layout_options.field_id',
311   `field_value` TEXT NOT NULL,
312   PRIMARY KEY (`id`),
313   KEY `uid` (`uid`,`facility_id`,`field_id`)
314 ) ENGINE=MyISAM  AUTO_INCREMENT=1 ;
315 #EndIf
317 #IfNotRow layout_options form_id FACUSR
318 INSERT INTO `layout_options` (form_id, field_id, group_name, title, seq, data_type, uor, fld_length, max_length, list_id, titlecols, datacols, default_value, edit_options, description) VALUES ('FACUSR', 'provider_id', '1General', 'Provider ID', 1, 2, 1, 15, 63, '', 1, 1, '', '', 'Provider ID at Specified Facility');
319 #EndIf
321 #IfMissingColumn patient_data ref_providerID
322 ALTER TABLE `patient_data` ADD COLUMN `ref_providerID` int(11) default NULL;
323 UPDATE `patient_data` SET `ref_providerID`=`providerID`;
324 INSERT INTO `layout_options` (form_id, field_id, group_name, title, seq, data_type, uor, fld_length, max_length, list_id, titlecols, datacols, default_value, edit_options, description) VALUES ('DEM', 'ref_providerID', '3Choices', 'Referring Provider', 2, 11, 1, 0, 0, '', 1, 3, '', '', 'Referring Provider');
325 UPDATE `layout_options` SET `description`='Provider' WHERE `form_id`='DEM' AND `field_id`='providerID';
326 UPDATE `layout_options` SET `seq`=(1+`seq`) WHERE `form_id`='DEM' AND `group_name` LIKE '%Choices' AND `field_id` != 'providerID' AND `field_id` != 'ref_providerID';
327 #EndIf
329 #IfMissingColumn documents couch_docid
330 ALTER TABLE `documents` ADD COLUMN `couch_docid` VARCHAR(100) NULL;
331 #EndIf
333 #IfMissingColumn documents couch_revid
334 ALTER TABLE `documents` ADD COLUMN `couch_revid` VARCHAR(100) NULL;
335 #EndIf
337 #IfMissingColumn documents storagemethod
338 ALTER TABLE `documents` ADD COLUMN `storagemethod` TINYINT(4) DEFAULT '0' NOT NULL COMMENT '0->Harddisk,1->CouchDB';
339 #EndIf
341 #IfNotRow2D list_options list_id lists option_id ptlistcols
342 insert into list_options (list_id, option_id, title, seq, option_value, mapping, notes) values('lists','ptlistcols','Patient List Columns','1','0','','');
343 insert into list_options (list_id, option_id, title, seq, option_value, mapping, notes) values('ptlistcols','name'      ,'Full Name'     ,'10','3','','');
344 insert into list_options (list_id, option_id, title, seq, option_value, mapping, notes) values('ptlistcols','phone_home','Home Phone'    ,'20','3','','');
345 insert into list_options (list_id, option_id, title, seq, option_value, mapping, notes) values('ptlistcols','ss'        ,'SSN'           ,'30','3','','');
346 insert into list_options (list_id, option_id, title, seq, option_value, mapping, notes) values('ptlistcols','DOB'       ,'Date of Birth' ,'40','3','','');
347 insert into list_options (list_id, option_id, title, seq, option_value, mapping, notes) values('ptlistcols','pubpid'    ,'External ID'   ,'50','3','','');
348 #EndIf
350 #IfNotRow2D code_types ct_key DSMIV ct_mod 0
351 UPDATE `code_types` SET `ct_mod`=0 WHERE `ct_key`='DSMIV' OR `ct_key`='ICD9' OR `ct_key`='ICD10' OR `ct_key`='SNOMED';
352 #EndIf
354 #IfMissingColumn layout_options fld_rows
355 ALTER TABLE `layout_options` ADD COLUMN `fld_rows` int(11) NOT NULL default '0';
356 UPDATE `layout_options` SET `fld_rows`=max_length WHERE `data_type`='3';
357 UPDATE `layout_options` SET `max_length`='0' WHERE `data_type`='3';
358 UPDATE `layout_options` SET `max_length`='0' WHERE `data_type`='34';
359 UPDATE `layout_options` SET `max_length`='20' WHERE `field_id`='financial_review' AND `form_id`='DEM';
360 UPDATE `layout_options` SET `max_length`='0' WHERE `field_id`='history_father' AND `form_id`='HIS';
361 UPDATE `layout_options` SET `max_length`='0' WHERE `field_id`='history_mother' AND `form_id`='HIS';
362 UPDATE `layout_options` SET `max_length`='0' WHERE `field_id`='history_siblings' AND `form_id`='HIS';
363 UPDATE `layout_options` SET `max_length`='0' WHERE `field_id`='history_spouse' AND `form_id`='HIS';
364 UPDATE `layout_options` SET `max_length`='0' WHERE `field_id`='history_offspring' AND `form_id`='HIS';
365 UPDATE `layout_options` SET `max_length`='0' WHERE `field_id`='relatives_cancer' AND `form_id`='HIS';
366 UPDATE `layout_options` SET `max_length`='0' WHERE `field_id`='relatives_tuberculosis' AND `form_id`='HIS';
367 UPDATE `layout_options` SET `max_length`='0' WHERE `field_id`='relatives_diabetes' AND `form_id`='HIS';
368 UPDATE `layout_options` SET `max_length`='0' WHERE `field_id`='relatives_high_blood_pressure' AND `form_id`='HIS';
369 UPDATE `layout_options` SET `max_length`='0' WHERE `field_id`='relatives_heart_problems' AND `form_id`='HIS';
370 UPDATE `layout_options` SET `max_length`='0' WHERE `field_id`='relatives_stroke' AND `form_id`='HIS';
371 UPDATE `layout_options` SET `max_length`='0' WHERE `field_id`='relatives_epilepsy' AND `form_id`='HIS';
372 UPDATE `layout_options` SET `max_length`='0' WHERE `field_id`='relatives_mental_illness' AND `form_id`='HIS';
373 UPDATE `layout_options` SET `max_length`='0' WHERE `field_id`='relatives_suicide' AND `form_id`='HIS';
374 UPDATE `layout_options` SET `max_length`='0' WHERE `field_id`='coffee' AND `form_id`='HIS';
375 UPDATE `layout_options` SET `max_length`='0' WHERE `field_id`='tobacco' AND `form_id`='HIS';
376 UPDATE `layout_options` SET `max_length`='0' WHERE `field_id`='alcohol' AND `form_id`='HIS';
377 UPDATE `layout_options` SET `max_length`='0' WHERE `field_id`='recreational_drugs' AND `form_id`='HIS';
378 UPDATE `layout_options` SET `max_length`='0' WHERE `field_id`='counseling' AND `form_id`='HIS';
379 UPDATE `layout_options` SET `max_length`='0' WHERE `field_id`='exercise_patterns' AND `form_id`='HIS';
380 UPDATE `layout_options` SET `max_length`='0' WHERE `field_id`='hazardous_activities' AND `form_id`='HIS';
381 UPDATE `layout_options` SET `max_length`='0' WHERE `field_id`='sleep_patterns' AND `form_id`='HIS';
382 UPDATE `layout_options` SET `max_length`='0' WHERE `field_id`='seatbelt_use' AND `form_id`='HIS';
383 #EndIf
385 #IfNotColumnType history_data usertext11 TEXT
386 ALTER TABLE `history_data` CHANGE `usertext11` `usertext11` TEXT NOT NULL;
387 #EndIf
389 #IfMissingColumn x12_partners x12_isa01
390 ALTER TABLE x12_partners ADD COLUMN x12_isa01 VARCHAR( 2 ) NOT NULL DEFAULT '00' COMMENT 'User logon Required Indicator';
391 #EndIf
393 #IfMissingColumn x12_partners x12_isa02
394 ALTER TABLE x12_partners ADD COLUMN x12_isa02 VARCHAR( 10 ) NOT NULL DEFAULT '          ' COMMENT 'User Logon';
395 #EndIf
397 #IfMissingColumn x12_partners x12_isa03
398 ALTER TABLE x12_partners ADD COLUMN x12_isa03 VARCHAR( 2 ) NOT NULL DEFAULT '00' COMMENT 'User password required Indicator';
399 #EndIf
401 #IfMissingColumn x12_partners x12_isa04
402 ALTER TABLE x12_partners ADD COLUMN x12_isa04 VARCHAR( 10 ) NOT NULL DEFAULT '          ' COMMENT 'User Password';
403 #EndIf
405 #IfMissingColumn codes financial_reporting
406 ALTER TABLE `codes` ADD COLUMN `financial_reporting` TINYINT(1) DEFAULT 0 COMMENT '0 = negative, 1 = considered important code in financial reporting';
407 #EndIf