Maintaing the custom tables in openemr

Could you please advise on the best approach for integrating custom tables into OpenEMR? Should we adhere to OpenEMR standards and keep our own tables within the system, or is it preferable to create extensions and maintain our own database? Additionally, how would either approach impact system upgrades in the future? If we are going to create extensions how we are going to maintain the table.sql file in the system

You have already answered to your questions in your message! You want to add custom tables and you dont wan to do that in “standard” tables that are already in OpenEMR.

But whatever you are doing is useful to others then consisder doing that in OpenEMR DB.

- ViSolve OpenEMR Support Team

Don’t modify the core tables if you want to be able to easily handle upgrades. You can keep tables in the same database schema but I’d recommend prefixing them with some kind of namespace id so you don’t run into naming collisions in the future.

The table.sql file can use much of the same OpenEMR upgrade syntax that OpenEMR’s upgrade scripts use. Look at the sql files in the OpenEMR sql folder to see the syntax.

I believe there is a mechanism to have individual upgrade sql files in your module’s sql folder but I forget the mechanism. @Amiel’s team I believe implemented that functionality. It may only be available for Laminas/Zend modules though and not for modules that don’t follow that framework (IE modules stored in the custom_modules folder instead of the zend_modules folder).

1 Like