Failure during database access! Check server error log

samsalas wrote on Tuesday, January 21, 2014:

I’m trying to upgrade from 4.1.0 to 4.1.2 on a ubuntu VMware server. After following the directions, I do have a log in page, but after logging in I get the following error.

“Failure during database access! Check server error log”.

I would appreciate any help. Thanks in advance.

yehster wrote on Tuesday, January 21, 2014:

This usually means that the users_secure table wasn’t created correctly during the upgrade process.

Did you run all of the sql upgrade scripts?

samsalas wrote on Tuesday, January 21, 2014:

I believe I ran all of the scripts. I logged what I did.

wget downloads.sourceforge.net/openemr/openemr_4.1.2-2_all.deb
sudo apt-get update
sudo dpkg -i openemr_4.1.2-2_all.deb

-answer yes to upgrade

-had to run do to errors
sudo apt-get install -f

-answer yes to reconfigure

sudo vim /etc/apache2/httpd.conf

-added

<Directory “/var/www/openemr/sites//documents">
order deny,allow Deny from all

<Directory "/var/www/openemr/sites/
/edi”>
order deny,allow Deny from all

<Directory “/var/www/openemr/sites/*/era”>
order deny,allow Deny from all

-then restart apache
sudo /etc/init.d/apache2 restart

-add ServerName localhost to remove apache error
sudo vim /etc/apache2/apache2.conf

#added ServerName
ServerName localhost

tried logging into

samsalas wrote on Tuesday, January 21, 2014:

The parts that are within the less than and greater than within the httpd.conf lines do not print here.

yehster wrote on Tuesday, January 21, 2014:

I am not familiar with the upgrade process using the .deb packages. That’s Brady’s domain. However, I think you still need to run the sql_upgrade.php scripts separately from the browser.

You likely need to run the scripts for both upgrading from 4.1.0 to 4.1.1 and 4.1.1 to 4.1.2 It does not hurt to run these scripts more than once so if the package installer already did so, manually running them too won’t cause a problem.

bradymiller wrote on Thursday, January 23, 2014:

Hi,

The .deb packages run the sql and acl upgrades automatically, so this should not be needed (at least not hopefully needed).

What do the text files in the following directories show:
/etc/openemr/*
/var/log/openemr/*

The “answer yes to reconfigure” statement seems odd, can you provide more details on that?

-brady
OpenEMR

yehster wrote on Thursday, January 23, 2014:

Wondering how the .deb packages behave if OpenEMR was not initially installed that way.

samsalas wrote on Thursday, January 23, 2014:

The text file in /etc/openemr/* states “process=complete” nothing else, and the txt file located in /var/log/openemr/* states “OpenEMR upgrade is complete.”.

About the reconfigure, I believe it asked if I wished to reconfigure apache.
I’m going to go thru it once more to be sure.

samsalas wrote on Friday, January 24, 2014:

Ok! after running
sudo apt-get install -f

I received:

The following packages will be upgraded:
libapache2-mod-php5 libcups2 php5-cli php5-common php5-mysql
5 upgraded, 77 newly installed, 0 to remove and 56 not upgraded.
1 not fully installed or removed.
Need to get 25.3 MB of archives.
After this operation, 64.3 MB of additional disk space will be used.
Do you want to continue [Y/n]?

This is where I answered yes to reconfigure

samsalas wrote on Friday, January 24, 2014:

After it ran I received:

Package configuration

┌──────────────────────────────┤ Configuring openemr ├ │ │ │ CONGRATULATIONS │ │ │ │ OpenEMR has been successfully upgraded. │ │ │ │ Recommend setting optional configuration settings in │ │ /var/www/openemr/sites//config.php (We have renamed your old │ │ configuration file to config.OLD) (We recommend you delete the config.OLD file │ │ when done) │ │ │ │ We have placed backup of your old OpenEMR in /tmp/openemr-tmp/ (We recommend you │ │ copy this somewhere protected since it contains confidential patient │ │ information) │ │ │ │ │ │ │ └───────────────────────────────────────────

samsalas wrote on Friday, January 24, 2014:

After which, I proceeded to step 2 of the upgrade.

bradymiller wrote on Friday, January 24, 2014:

Hi SSalas,

There should be a lot more in the file at /var/log/openemr/* . I don’t remember the specific name of the log file in the directory, but it should contain pages of stuff.

Also, what OpenEMR version are you upgrading from?

-brady
OpenEMR

bradymiller wrote on Friday, January 24, 2014:

disregard the OpenEMR version question, saw above going from 4.1.0 .

bradymiller wrote on Friday, January 24, 2014:

Also,
One more question is whether your previous openemr version was installed via the package or via other mechanism.
-brady

bradymiller wrote on Friday, January 24, 2014:

Kevin,

Check out the docs for the upgrade here:
http://www.open-emr.org/wiki/index.php/Ubuntu_Package_Upgrade_to_4.1.2
(The Overview answers your question; it will upgrade openemr even if it was not installed via the package as long as it is in the /var/www/openemr directory)

-brady
OpenEMR

samsalas wrote on Friday, January 24, 2014:

Thu Jan 23 18:24:04 PST 2014: For upgrade, confirmed that the mysql database (oemr) and mysql user (root) exist
Thu Jan 23 18:28:08 PST 2014: Upgrading OpenEMR from 4.1.0-1…
Thu Jan 23 18:37:46 PST 2014: Configuring package…
Thu Jan 23 18:37:46 PST 2014: Continuing Upgrade from (4.1.0-1)
Thu Jan 23 18:37:46 PST 2014: Configuring Site (default)
PHP Notice: Undefined index: REQUEST_URI in /var/www/openemr/interface/globals.php on line 19
PHP Notice: Undefined index: SERVER_NAME in /var/www/openemr/sites/default/config.php on line 82

OpenEMR Database Upgrade OpenEMR Database Upgrade
Processing 4_1_0-to-4_1_1_upgrade.sql ...
Skipping section #IfNotIndex lists type
Skipping section #IfNotIndex lists pid
Skipping section #IfNotIndex form_vitals pid
DROP INDEX `pid` ON `forms`
DROP INDEX `pid` ON `form_encounter`
CREATE INDEX `pid_encounter` ON `forms` (`pid`, `encounter`)
CREATE INDEX `pid_encounter` ON `form_encounter` (`pid`, `encounter`)
Skipping section #IfNotIndex immunizations patient_id
Skipping section #IfNotIndex procedure_order patient_id
Skipping section #IfNotIndex pnotes pid
Skipping section #IfNotIndex transactions pid
Skipping section #IfNotIndex extended_log patient_id
Skipping section #IfNotIndex prescriptions patient_id
CREATE INDEX `pc_eventDate` ON `openemr_postcalendar_events` (`pc_eventDate`)
Skipping section #IfMissingColumn version v_realpatch
Skipping section #IfMissingColumn prescriptions drug_info_erx
INSERT INTO `list_options` (`list_id`, `option_id`, `title`, `seq`) VALUES ('lists','nation_notes_replace_buttons','Nation Notes Replace Buttons',1)
INSERT INTO `list_options` (`list_id`, `option_id`, `title`, `seq`) VALUES ('nation_notes_replace_buttons','Yes','Yes',10)
INSERT INTO `list_options` (`list_id`, `option_id`, `title`, `seq`) VALUES ('nation_notes_replace_buttons','No','No',20)
INSERT INTO `list_options` (`list_id`, `option_id`, `title`, `seq`) VALUES ('nation_notes_replace_buttons','Normal','Normal',30)
INSERT INTO `list_options` (`list_id`, `option_id`, `title`, `seq`) VALUES ('nation_notes_replace_buttons','Abnormal','Abnormal',40)
Skipping section #IfMissingColumn insurance_data policy_type
ALTER TABLE drugs ADD max_level float NOT NULL DEFAULT 0.0
ALTER TABLE drugs CHANGE reorder_point reorder_point float NOT NULL DEFAULT 0.0
Skipping section #IfNotTable product_warehouse
Skipping section #IfNotColumnType billing modifier varchar(12)
Skipping section #IfMissingColumn billing notecodes
Skipping section #IfNotTable dated_reminders
Skipping section #IfNotTable dated_reminders_link
ALTER TABLE `x12_partners` ADD COLUMN `x12_gs03` VARCHAR(15) NOT NULL DEFAULT ''
Skipping section #IfNotTable payment_gateway_details
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','','')
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','','')
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','','')
ALTER TABLE `patient_access_offsite` ADD COLUMN `authorize_net_id` VARCHAR(20) COMMENT 'authorize.net profile id'
ALTER TABLE `facility` ADD COLUMN `website` varchar(255) default NULL
ALTER TABLE `facility` ADD COLUMN `email` varchar(255) default NULL
ALTER TABLE `code_types` ADD COLUMN `ct_active` tinyint(1) NOT NULL default 1 COMMENT '1 if this is active'
ALTER TABLE `code_types` ADD COLUMN `ct_label` varchar(31) NOT NULL default '' COMMENT 'label of this code type'
UPDATE `code_types` SET ct_label = ct_key
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'
DROP TABLE IF EXISTS `temp_table_one`
CREATE TABLE `temp_table_one` ( `id` int(11) NOT NULL DEFAULT '0', `seq` int(11) NOT NULL DEFAULT '0') ENGINE=MyISAM
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 ) )
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)
DROP TABLE `temp_table_one`
DROP TABLE IF EXISTS `temp_table_one`
CREATE TABLE `temp_table_one` ( `id` int(11) NOT NULL DEFAULT '0', `seq` int(11) NOT NULL DEFAULT '0') ENGINE=MyISAM
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 ) )
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)
DROP TABLE `temp_table_one`
DROP TABLE IF EXISTS `temp_table_one`
CREATE TABLE `temp_table_one` ( `id` int(11) NOT NULL DEFAULT '0', `seq` int(11) NOT NULL DEFAULT '0') ENGINE=MyISAM
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 ) )
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)
DROP TABLE `temp_table_one`
ALTER TABLE `ar_activity` ADD COLUMN `code_type` varchar(12) NOT NULL DEFAULT ''
DROP TABLE IF EXISTS `temp_table_one`
CREATE TABLE `temp_table_one` ( id int unsigned NOT NULL AUTO_INCREMENT, session_id int unsigned NOT NULL, payer_id int(11) NOT NULL DEFAULT 0, user_id int(11) NOT NULL, pay_total decimal(12,2) NOT NULL DEFAULT 0, payment_type varchar( 50 ) NOT NULL DEFAULT 'patient', description text NOT NULL, adjustment_code varchar( 50 ) NOT NULL DEFAULT 'patient_payment', post_to_date date NOT NULL, patient_id int( 11 ) NOT NULL, payment_method varchar( 25 ) NOT NULL DEFAULT 'cash', pid int(11) NOT NULL, encounter int(11) NOT NULL, code_type varchar(12) NOT NULL DEFAULT '', code varchar(9) NOT NULL, modifier varchar(5) NOT NULL DEFAULT '', payer_type int NOT NULL DEFAULT 0, post_time datetime NOT NULL, post_user int(11) NOT NULL, pay_amount decimal(12,2) NOT NULL DEFAULT 0, account_code varchar(15) NOT NULL DEFAULT 'PCP', PRIMARY KEY (id)) ENGINE=MyISAM AUTO_INCREMENT=1
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
UPDATE `temp_table_one` SET `session_id`= ((SELECT MAX(session_id) FROM ar_session)+`id`)
UPDATE `billing`, `code_types`, `temp_table_one` SET temp_table_one.code_type=billing.code_type, 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
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`
INSERT INTO `ar_activity` (`pid`, `encounter`, `code_type`, `code`, `modifier`, `payer_type`, `post_time`, `post_user`, `session_id`, `pay_amount`, `account_code`) SELECT `pid`, `encounter`, `code_type`, `code`, `modifier`, `payer_type`, `post_time`, `post_user`, `session_id`, `pay_amount`, `account_code` FROM `temp_table_one`
UPDATE `billing` SET `activity`=0 WHERE `code_type`='COPAY'
DROP TABLE IF EXISTS `temp_table_one`
Skipping section #IfNotTable facility_user_ids
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')
ALTER TABLE `patient_data` ADD COLUMN `ref_providerID` int(11) default NULL
UPDATE `patient_data` SET `ref_providerID`=`providerID`
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')
UPDATE `layout_options` SET `description`='Provider' WHERE `form_id`='DEM' AND `field_id`='providerID'
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'
ALTER TABLE `documents` ADD COLUMN `couch_docid` VARCHAR(100) NULL
ALTER TABLE `documents` ADD COLUMN `couch_revid` VARCHAR(100) NULL
ALTER TABLE `documents` ADD COLUMN `storagemethod` TINYINT(4) DEFAULT '0' NOT NULL COMMENT '0->Harddisk,1->CouchDB'
insert into list_options (list_id, option_id, title, seq, option_value, mapping, notes) values('lists','ptlistcols','Patient List Columns','1','0','','')
insert into list_options (list_id, option_id, title, seq, option_value, mapping, notes) values('ptlistcols','name' ,'Full Name' ,'10','3','','')
insert into list_options (list_id, option_id, title, seq, option_value, mapping, notes) values('ptlistcols','phone_home','Home Phone' ,'20','3','','')
insert into list_options (list_id, option_id, title, seq, option_value, mapping, notes) values('ptlistcols','ss' ,'SSN' ,'30','3','','')
insert into list_options (list_id, option_id, title, seq, option_value, mapping, notes) values('ptlistcols','DOB' ,'Date of Birth' ,'40','3','','')
insert into list_options (list_id, option_id, title, seq, option_value, mapping, notes) values('ptlistcols','pubpid' ,'External ID' ,'50','3','','')
UPDATE `code_types` SET `ct_mod`=0 WHERE `ct_key`='DSMIV' OR `ct_key`='ICD9' OR `ct_key`='ICD10' OR `ct_key`='SNOMED'
ALTER TABLE `layout_options` ADD COLUMN `fld_rows` int(11) NOT NULL default '0'
UPDATE `layout_options` SET `fld_rows`=max_length WHERE `data_type`='3'
UPDATE `layout_options` SET `max_length`='0' WHERE `data_type`='3'
UPDATE `layout_options` SET `max_length`='0' WHERE `data_type`='34'
UPDATE `layout_options` SET `max_length`='20' WHERE `field_id`='financial_review' AND `form_id`='DEM'
UPDATE `layout_options` SET `max_length`='0' WHERE `field_id`='history_father' AND `form_id`='HIS'
UPDATE `layout_options` SET `max_length`='0' WHERE `field_id`='history_mother' AND `form_id`='HIS'
UPDATE `layout_options` SET `max_length`='0' WHERE `field_id`='history_siblings' AND `form_id`='HIS'
UPDATE `layout_options` SET `max_length`='0' WHERE `field_id`='history_spouse' AND `form_id`='HIS'
UPDATE `layout_options` SET `max_length`='0' WHERE `field_id`='history_offspring' AND `form_id`='HIS'
UPDATE `layout_options` SET `max_length`='0' WHERE `field_id`='relatives_cancer' AND `form_id`='HIS'
UPDATE `layout_options` SET `max_length`='0' WHERE `field_id`='relatives_tuberculosis' AND `form_id`='HIS'
UPDATE `layout_options` SET `max_length`='0' WHERE `field_id`='relatives_diabetes' AND `form_id`='HIS'
UPDATE `layout_options` SET `max_length`='0' WHERE `field_id`='relatives_high_blood_pressure' AND `form_id`='HIS'
UPDATE `layout_options` SET `max_length`='0' WHERE `field_id`='relatives_heart_problems' AND `form_id`='HIS'
UPDATE `layout_options` SET `max_length`='0' WHERE `field_id`='relatives_stroke' AND `form_id`='HIS'
UPDATE `layout_options` SET `max_length`='0' WHERE `field_id`='relatives_epilepsy' AND `form_id`='HIS'
UPDATE `layout_options` SET `max_length`='0' WHERE `field_id`='relatives_mental_illness' AND `form_id`='HIS'
UPDATE `layout_options` SET `max_length`='0' WHERE `field_id`='relatives_suicide' AND `form_id`='HIS'
UPDATE `layout_options` SET `max_length`='0' WHERE `field_id`='coffee' AND `form_id`='HIS'
UPDATE `layout_options` SET `max_length`='0' WHERE `field_id`='tobacco' AND `form_id`='HIS'
UPDATE `layout_options` SET `max_length`='0' WHERE `field_id`='alcohol' AND `form_id`='HIS'
UPDATE `layout_options` SET `max_length`='0' WHERE `field_id`='recreational_drugs' AND `form_id`='HIS'
UPDATE `layout_options` SET `max_length`='0' WHERE `field_id`='counseling' AND `form_id`='HIS'
UPDATE `layout_options` SET `max_length`='0' WHERE `field_id`='exercise_patterns' AND `form_id`='HIS'
UPDATE `layout_options` SET `max_length`='0' WHERE `field_id`='hazardous_activities' AND `form_id`='HIS'
UPDATE `layout_options` SET `max_length`='0' WHERE `field_id`='sleep_patterns' AND `form_id`='HIS'
UPDATE `layout_options` SET `max_length`='0' WHERE `field_id`='seatbelt_use' AND `form_id`='HIS'
ALTER TABLE `history_data` CHANGE `usertext11` `usertext11` TEXT NOT NULL
ALTER TABLE x12_partners ADD COLUMN x12_isa01 VARCHAR( 2 ) NOT NULL DEFAULT '00' COMMENT 'User logon Required Indicator'
ALTER TABLE x12_partners ADD COLUMN x12_isa02 VARCHAR( 10 ) NOT NULL DEFAULT ' ' COMMENT 'User Logon'
ALTER TABLE x12_partners ADD COLUMN x12_isa03 VARCHAR( 2 ) NOT NULL DEFAULT '00' COMMENT 'User password required Indicator'
ALTER TABLE x12_partners ADD COLUMN x12_isa04 VARCHAR( 10 ) NOT NULL DEFAULT ' ' COMMENT 'User Password'
ALTER TABLE `codes` ADD COLUMN `financial_reporting` TINYINT(1) DEFAULT 0 COMMENT '0 = negative, 1 = considered important code in financial reporting'
ALTER TABLE `codes` CHANGE `code_type` `code_type` SMALLINT(6) default NULL
CREATE INDEX `code_type` ON `codes` (`code_type`)
ALTER TABLE `billing` CHANGE `code_type` `code_type` VARCHAR(15) default NULL
ALTER TABLE `codes` CHANGE `modifier` `modifier` VARCHAR(12) NOT NULL default ''
ALTER TABLE `ar_activity` CHANGE `modifier` `modifier` VARCHAR(12) NOT NULL default ''
DROP TABLE IF EXISTS `temp_table_one`
CREATE TABLE `temp_table_one` ( `id` int(11) NOT NULL DEFAULT '0', `seq` int(11) NOT NULL DEFAULT '0') ENGINE=MyISAM
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 ) )
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 ('CPTII' , (SELECT MAX(`id`) FROM `temp_table_one`), (SELECT MAX(`seq`) FROM `temp_table_one`), 12, 'ICD9', 1, 0, 0, 0, 0, 'CPTII', 0)
DROP TABLE `temp_table_one`
DROP TABLE IF EXISTS `temp_table_one`
CREATE TABLE `temp_table_one` ( `id` int(11) NOT NULL DEFAULT '0', `seq` int(11) NOT NULL DEFAULT '0') ENGINE=MyISAM
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 ) )
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 ('ICD9-SG' , (SELECT MAX(`id`) FROM `temp_table_one`), (SELECT MAX(`seq`) FROM `temp_table_one`), 12, 'ICD9', 1, 0, 0, 0, 0, 'ICD9 Procedure/Service', 5)
DROP TABLE `temp_table_one`
DROP TABLE IF EXISTS `temp_table_one`
CREATE TABLE `temp_table_one` ( `id` int(11) NOT NULL DEFAULT '0', `seq` int(11) NOT NULL DEFAULT '0') ENGINE=MyISAM
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 ) )
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-PCS' , (SELECT MAX(`id`) FROM `temp_table_one`), (SELECT MAX(`seq`) FROM `temp_table_one`), 12, 'ICD10', 1, 0, 0, 0, 0, 'ICD10 Procedure/Service', 6)
DROP TABLE `temp_table_one`
UPDATE `code_types` SET `ct_label`='ICD9 Diagnosis' WHERE `ct_key`='ICD9'
UPDATE `code_types` SET `ct_label`='CPT4 Procedure/Service' WHERE `ct_key`='CPT4'
UPDATE `code_types` SET `ct_label`='HCPCS Procedure/Service' WHERE `ct_key`='HCPCS'
UPDATE `code_types` SET `ct_label`='CVX Immunization' WHERE `ct_key`='CVX'
UPDATE `code_types` SET `ct_label`='DSMIV Diagnosis' WHERE `ct_key`='DSMIV'
UPDATE `code_types` SET `ct_label`='ICD10 Diagnosis' WHERE `ct_key`='ICD10'
UPDATE `code_types` SET `ct_label`='SNOMED Diagnosis' WHERE `ct_key`='SNOMED'
ALTER TABLE `code_types` ADD COLUMN `ct_claim` tinyint(1) NOT NULL default 0 COMMENT '1 if this is used in claims'
UPDATE `code_types` SET `ct_claim`='1' WHERE `ct_key`='ICD9' OR `ct_key`='CPT4' OR `ct_key`='HCPCS' OR `ct_key`='DSMIV' OR `ct_key`='ICD10' OR `ct_key`='SNOMED' OR `ct_key`='CPTII' OR `ct_key`='ICD9-SG' OR `ct_key`='ICD10-PCS'
UPDATE `code_types` SET `ct_fee`='0', `ct_mod`='0', `ct_label`='CPTII Performance Measures' WHERE `ct_key`='CPTII'
Skipping section #IfNotTable icd9_dx_code
Skipping section #IfNotTable icd9_sg_code
Skipping section #IfNotTable icd9_dx_long_code
Skipping section #IfNotTable icd9_sg_long_code
Skipping section #IfNotTable icd10_dx_order_code
Skipping section #IfNotTable icd10_pcs_order_code
Skipping section #IfNotTable icd10_gem_pcs_9_10
Skipping section #IfNotTable icd10_gem_pcs_10_9
Skipping section #IfNotTable icd10_gem_dx_9_10
Skipping section #IfNotTable icd10_gem_dx_10_9
Skipping section #IfNotTable icd10_reimbr_dx_9_10
Skipping section #IfNotTable icd10_reimbr_pcs_9_10
Skipping section #IfNotTable supported_external_dataloads
ALTER TABLE `standardized_tables_track` ADD COLUMN `file_checksum` varchar(32)
ALTER TABLE `code_types` ADD COLUMN `ct_proc` tinyint(1) NOT NULL default 0 COMMENT '1 if this is a procedure type'
UPDATE `code_types` SET `ct_proc`='1' WHERE `ct_key`='CPT4' OR `ct_key`='HCPCS' OR `ct_key`='ICD9-SG' OR `ct_key`='ICD10-PCS'
CREATE INDEX `form_id` ON `forms` (`form_id`)
Processing 4_1_1-to-4_1_2_upgrade.sql ...
Skipping section #IfNotTable report_results
ALTER TABLE `version` ADD COLUMN `v_acl` int(11) NOT NULL DEFAULT 0
ALTER TABLE `documents_legal_detail` ADD COLUMN `dld_moved` tinyint(4) NOT NULL DEFAULT '0'
ALTER TABLE `documents_legal_detail` ADD COLUMN `dld_patient_comments` text COMMENT 'Patient comments stored here'
ALTER TABLE `documents_legal_master` ADD COLUMN `dlm_upload_type` tinyint(4) DEFAULT '0' COMMENT '0-Provider Uploaded,1-Patient Uploaded'
ALTER TABLE `list_options` ADD COLUMN `codes` varchar(255) NOT NULL DEFAULT ''
UPDATE list_options SET `codes`='SNOMED-CT:449868002' WHERE list_id='smoking_status' AND option_id='1' AND title='Current every day smoker'
UPDATE list_options SET `codes`='SNOMED-CT:428041000124106' WHERE list_id='smoking_status' AND option_id='2' AND title='Current some day smoker'
UPDATE list_options SET `codes`='SNOMED-CT:8517006' WHERE list_id='smoking_status' AND option_id='3' AND title='Former smoker'
UPDATE list_options SET `codes`='SNOMED-CT:266919005' WHERE list_id='smoking_status' AND option_id='4' AND title='Never smoker'
UPDATE list_options SET `codes`='SNOMED-CT:77176002' WHERE list_id='smoking_status' AND option_id='5' AND title='Smoker, current status unknown'
UPDATE list_options SET `codes`='SNOMED-CT:266927001' WHERE list_id='smoking_status' AND option_id='9' AND title='Unknown if ever smoked'
INSERT INTO list_options ( list_id, option_id, title, seq, is_default, codes ) VALUES ('smoking_status', '15', 'Heavy tobacco smoker', 70, 0, "SNOMED-CT:428071000124103")
INSERT INTO list_options ( list_id, option_id, title, seq, is_default, codes ) VALUES ('smoking_status', '16', 'Light tobacco smoker', 80, 0, "SNOMED-CT:428061000124105")
ALTER TABLE `code_types` ADD COLUMN ct_term tinyint(1) NOT NULL default 0 COMMENT '1 if this is a clinical term'
DROP TABLE IF EXISTS `temp_table_one`
CREATE TABLE `temp_table_one` ( `id` int(11) NOT NULL DEFAULT '0', `seq` int(11) NOT NULL DEFAULT '0') ENGINE=MyISAM
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 ) )
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, ct_claim, ct_proc, ct_term ) VALUES ('SNOMED-CT' , (SELECT MAX(`id`) FROM `temp_table_one`), (SELECT MAX(`seq`) FROM `temp_table_one`), 0, '', 0, 0, 1, 0, 0, 'SNOMED Clinical Term', 7, 0, 0, 1)
DROP TABLE `temp_table_one`
ALTER TABLE `codes` CHANGE `code` `code` varchar(25) NOT NULL default ''
ALTER TABLE `billing` CHANGE `code` `code` varchar(20) default NULL
ALTER TABLE `ar_activity` CHANGE `code` `code` varchar(20) NOT NULL COMMENT 'empty means claim level'
Skipping section #IfNotTable procedure_questions
ALTER TABLE `procedure_type` ADD COLUMN `activity` tinyint(1) NOT NULL default 1
ALTER TABLE `procedure_type` ADD COLUMN `notes` varchar(255) NOT NULL default ''
Skipping section #IfNotTable procedure_answers
Skipping section #IfNotTable procedure_providers
Skipping section #IfNotTable procedure_order_code
ALTER TABLE `procedure_order` ADD COLUMN `lab_id` bigint(20) NOT NULL DEFAULT 0 COMMENT 'references procedure_providers.ppid', ADD COLUMN `specimen_type` varchar(31) NOT NULL DEFAULT '' COMMENT 'from the Specimen_Type list', ADD COLUMN `specimen_location` varchar(31) NOT NULL DEFAULT '' COMMENT 'from the Specimen_Location list', ADD COLUMN `specimen_volume` varchar(30) NOT NULL DEFAULT '' COMMENT 'from a text input field'
UPDATE procedure_order AS po, procedure_order_code AS pc, procedure_type AS pt SET po.lab_id = pt.lab_id WHERE po.lab_id = 0 AND pc.procedure_order_id = po.procedure_order_id AND pt.procedure_type_id = pc.procedure_type_id AND pt.lab_id != 0

ERROR: query failed: UPDATE procedure_order AS po, procedure_order_code AS pc, procedure_type AS pt SET po.lab_id = pt.lab_id WHERE po.lab_id = 0 AND pc.procedure_order_id = po.procedure_order_id AND pt.procedure_type_id = pc.procedure_type_id AND pt.lab_id != 0

Error: Unknown column 'pc.procedure_type_id' in 'where clause'

Thu Jan 23 18:37:54 PST 2014: Upgraded OpenEMR site (default) with sql database (oemr) and sql user (root). Thu Jan 23 18:40:26 PST 2014: OpenEMR upgrade is complete. Thu Jan 23 18:40:26 PST 2014: Recommend setting optional configuration settings in: Thu Jan 23 18:40:26 PST 2014: /var/www/openemr/sites//config.php Thu Jan 23 18:40:26 PST 2014: (We have renamed your old configuration files to *.OLD) Thu Jan 23 18:40:26 PST 2014: (We recommend you delete the *.OLD files when done) Thu Jan 23 18:40:26 PST 2014: We have placed backup of your old OpenEMR in /tmp/openemr-tmp Thu Jan 23 18:40:26 PST 2014: (We recommend you copy this somewhere protected since it Thu Jan 23 18:40:26 PST 2014: contains confidential patient information)

bradymiller wrote on Saturday, January 25, 2014:

Hi,

It looks like your error is secondary to customizations where you brought in some of the procedure work in; this is noted because of the skipping statements regarding procedure_* tables(meaning you already have them installed); this leads to an error in the sql upgrade script to error out so you didn’t get all the required updates to your database. Did you patch any of the newer procedure stuff in to your prior openemr version? If so, will take a bit of intelligent “tinkering” to the database prior to upgrade to get it to work.

I think this type of error has shown up before. Perhaps Kevin or Rod can weigh in.

-brady
OpenEMR

samsalas wrote on Saturday, January 25, 2014:

I had someone perform some customizations and am not sure if he patched any of the newer procedure into my openemr version. I don’t understand why he would have.

bahopolyclinic wrote on Sunday, January 26, 2014:

Dears,
Does anybody know how to set lab results or set lab test (lab investigations) in the OpenEMR.
Best regards,

samsalas wrote on Monday, January 27, 2014:

Mugabo, you may wish to look that up in the search discussion box up above and if you do not find an answer start a new thread for that question.