# Upgrading from 4.2.0 to OpenEMR 5.0.0

**URL:** <https://community.open-emr.org/t/upgrading-from-4-2-0-to-openemr-5-0-0/9235>\
**Category:** OpenEMR Development\
**Tags:** upgrade, question\
**Created:** [November 1, 2017, 7:31pm UTC](https://community.open-emr.org/t/upgrading-from-4-2-0-to-openemr-5-0-0/9235 "2017-11-01T19:31:59Z")\
**Posts on this page:** 10\
**Page:** 2

<div class="post-metadata">

**Author:** ![brady.miller](https://community.open-emr.org/user_avatar/community.open-emr.org/brady.miller/32/10178_2.png) [@brady.miller](https://community.open-emr.org/u/brady.miller)\
**Post date:** [February 28, 2018, 10:46am UTC](https://community.open-emr.org/t/upgrading-from-4-2-0-to-openemr-5-0-0/9235/21 "2018-02-28T10:46:33Z")

</div>

also @smirzaoe ,  
What does the schema of your layout\_options sql table look like (it is possible that since some upgrades worked and some didn’t that you likely added indexes to text or text-like fields).  
-brady

---

<div class="post-metadata">

**Author:** ![smirzaoe](https://community.open-emr.org/letter_avatar_proxy/v4/letter/s/9dc877/32.png) [@smirzaoe](https://community.open-emr.org/u/smirzaoe)\
**Post date:** [March 1, 2018, 3:39am UTC](https://community.open-emr.org/t/upgrading-from-4-2-0-to-openemr-5-0-0/9235/22 "2018-03-01T03:39:49Z")

</div>

Hi Brady,

Thanks for your questions. That’s putting us in right direction. We were running MySQL 5.5.59 version. So we upgraded MySql to 5.6. After upgrading MySQL, we ran the sql\_upgrade.php. We didn’t get that error on layout\_options table. However, it is now giving below error now. I checked for the "select max(seq) from list\_options where list\_id = ‘order\_type’ "it is null in prod too.

Processing 4\_2\_2-to-5\_0\_0\_upgrade.sql …  
Skipping section #IfTextNullFixNeeded  
ALTER TABLE `ar_activity` MODIFY `sequence_no` int UNSIGNED NOT NULL COMMENT ‘Sequence\_no, incremented in code’  
ALTER TABLE `ar_activity` ENGINE=“InnoDB”  
ALTER TABLE `claims` MODIFY `version` int(10) UNSIGNED NOT NULL COMMENT ‘Version, incremented in code’  
ALTER TABLE `claims` ENGINE=“InnoDB”  
ALTER TABLE `procedure_answers` MODIFY `answer_seq` int(11) NOT NULL COMMENT ‘Supports multiple-choice questions. Answer\_seq, incremented in code’  
ALTER TABLE `procedure_answers` ENGINE=“InnoDB”  
ALTER TABLE `procedure_order_code` MODIFY `procedure_order_seq` int(11) NOT NULL COMMENT ‘Supports multiple tests per order. Procedure\_order\_seq incremented in code’  
ALTER TABLE `procedure_order_code` ENGINE=“InnoDB”  
Skipping section #IfInnoDBMigrationNeeded  
Skipping section #IfNotTable valueset  
Skipping section #IfMissingColumn openemr\_postcalendar\_categories pc\_active  
Skipping section #IfMissingColumn openemr\_postcalendar\_categories pc\_seq  
Skipping section #IfNotRow openemr\_postcalendar\_categories pc\_catname Health and Behavioral Assessment  
Skipping section #IfNotRow openemr\_postcalendar\_categories pc\_catname Preventive Care Services  
SET @max\_seq = (select max(seq) from list\_options where list\_id = ‘order\_type’)  
INSERT INTO `list_options` (`list_id`,`option_id`,`title`,`seq`,`is_default`) values (‘order\_type’,‘enc\_checkup\_procedure’,‘Encounter Checkup Procedure’,@max\_seq+10,0)  
ERROR: query failed: INSERT INTO `list_options` (`list_id`,`option_id`,`title`,`seq`,`is_default`) values (‘order\_type’,‘enc\_checkup\_procedure’,‘Encounter Checkup Procedure’,@max\_seq+10,0)

**Error: Column ‘seq’ cannot be null**

/var/www/openemr/library/sql\_upgrade\_fx.php at 675:sqlStatement  
/var/www/openemr/sql\_upgrade.php at 56:upgradeFromSqlFile(4\_2\_2-to-5\_0\_0\_upgrade.sql)

---

<div class="post-metadata">

**Author:** ![brady.miller](https://community.open-emr.org/user_avatar/community.open-emr.org/brady.miller/32/10178_2.png) [@brady.miller](https://community.open-emr.org/u/brady.miller)\
**Post date:** [March 1, 2018, 7:48pm UTC](https://community.open-emr.org/t/upgrading-from-4-2-0-to-openemr-5-0-0/9235/23 "2018-03-01T19:48:53Z")

</div>

hi @smirzaoe ,  
Guessing that you removed the order\_type (title Order Types) list (Administration-\>Lists) in that OpenEMR multisite instance. If you add that list back, does this upgrade script error go away?  
-brady

---

<div class="post-metadata">

**Author:** ![smirzaoe](https://community.open-emr.org/letter_avatar_proxy/v4/letter/s/9dc877/32.png) [@smirzaoe](https://community.open-emr.org/u/smirzaoe)\
**Post date:** [March 1, 2018, 8:43pm UTC](https://community.open-emr.org/t/upgrading-from-4-2-0-to-openemr-5-0-0/9235/24 "2018-03-01T20:43:20Z")

</div>

You the man! Yes, Order Types list is not there. Hmm…why would I remove order types from the list? I don’t see Order Statuses list too.I will add them back. I will keep you posted. Thanks a lot!  
Mirza

---

<div class="post-metadata">

**Author:** ![smirzaoe](https://community.open-emr.org/letter_avatar_proxy/v4/letter/s/9dc877/32.png) [@smirzaoe](https://community.open-emr.org/u/smirzaoe)\
**Post date:** [March 2, 2018, 3:45am UTC](https://community.open-emr.org/t/upgrading-from-4-2-0-to-openemr-5-0-0/9235/25 "2018-03-02T03:45:15Z")

</div>

Okay. We added Order Types list in the list\_options table and after that we had a few more similar hiccups. Finally we were able to run sql\_upgrade.php successfully.

We are able to login now. Which is great. When we tried to import layout\_options custom data from Openemr 4.0, into 5.0 it failed. Upon comparing table structures from 4.2 and 5.0, I see there is a small difference. We have to work on to fix the data manually and import, I guess.

---

<div class="post-metadata">

**Author:** ![brady.miller](https://community.open-emr.org/user_avatar/community.open-emr.org/brady.miller/32/10178_2.png) [@brady.miller](https://community.open-emr.org/u/brady.miller)\
**Post date:** [March 2, 2018, 5:11am UTC](https://community.open-emr.org/t/upgrading-from-4-2-0-to-openemr-5-0-0/9235/26 "2018-03-02T05:11:00Z")

</div>

hi @smirzaoe ,  
You could try to run the sql\_upgrade script on your custom layout\_options data from 4.0 to 5.0 in a testing openemr instance. Then could try to import that primed 5.0 layout\_options data. I think this should work.  
-brady

---

<div class="post-metadata">

**Author:** ![smirzaoe](https://community.open-emr.org/letter_avatar_proxy/v4/letter/s/9dc877/32.png) [@smirzaoe](https://community.open-emr.org/u/smirzaoe)\
**Post date:** [March 2, 2018, 9:38pm UTC](https://community.open-emr.org/t/upgrading-from-4-2-0-to-openemr-5-0-0/9235/27 "2018-03-02T21:38:59Z")

</div>

Hi Brady,

Thanks for the suggestion. I did exactly as you suggested and it worked. We have to apply few more custom changes and do thorough testing. We are almost done!  
-Mirza

---

<div class="post-metadata">

**Author:** ![smirzaoe](https://community.open-emr.org/letter_avatar_proxy/v4/letter/s/9dc877/32.png) [@smirzaoe](https://community.open-emr.org/u/smirzaoe)\
**Post date:** [March 5, 2018, 2:49am UTC](https://community.open-emr.org/t/upgrading-from-4-2-0-to-openemr-5-0-0/9235/28 "2018-03-05T02:49:37Z")

</div>

Hi Brady,

Just wanted to let you know that we were able to successfully apply the 5-0-0-Patch-7.

Thanks!

---

<div class="post-metadata">

**Author:** ![Hite1981](https://community.open-emr.org/letter_avatar_proxy/v4/letter/h/35a633/32.png) [@Hite1981](https://community.open-emr.org/u/Hite1981)\
**Post date:** [March 5, 2018, 6:58pm UTC](https://community.open-emr.org/t/upgrading-from-4-2-0-to-openemr-5-0-0/9235/29 "2018-03-05T18:58:22Z")

</div>

what if i am not able to do it? what i should do? please?! thanks

---

<div class="post-metadata">

**Author:** ![stephenwaite](https://community.open-emr.org/user_avatar/community.open-emr.org/stephenwaite/32/15754_2.png) [@stephenwaite](https://community.open-emr.org/u/stephenwaite)\
**Post date:** [March 5, 2018, 7:35pm UTC](https://community.open-emr.org/t/upgrading-from-4-2-0-to-openemr-5-0-0/9235/30 "2018-03-05T19:35:17Z")

</div>

hi @Hite1981, do you mean applying patch 7 or upgrading to 5.0.0?

[Previous page](https://community.open-emr.org/t/upgrading-from-4-2-0-to-openemr-5-0-0/9235.md?page=1)
