Correct way to migrate/alter database?

Good day,

I want to add some columns to an existing database table. Just wanted to check what the correct procedure is. I see that there is a sql directory. I’m assuming that I would just write a SQL script and place it here to alter the table. How do I run it? Is there a way to run it from within OpenEMR or from the shell or do I need to login to the MySQL server and run this manually?

Will this affect the backup feature in any way?

This project doesn’t provide a built-in localization approach.

If your changes are limited to existing database tables you can add and maintain local columns directly / manually. Since upgrade scripts typically affect standard columns in standard tables, your changes will not be affected. Unfortunately changes related to your columns in standard php scripts need to be reviewed with every version/patch update.

If you want to maintain your database changes in parallel to standard version, you can take a look at this command-line approach to updates.


1 Like

I’ve been replacing some tables for CIE10 in database so I have to run some SQL script for it. I’ve done it using PHPMyAdmin in my hosting server

An advise : before you did anything, create a duplicated copy of any table you will alter.

I’ve ruined my installation once to learn it


1 Like

Thanks, folks! I already have a backup of the database, was just asking the question in case there was a standard way to do migrations such as the way it’s done in Rails, Laravel, etc. Happy to do it manually if this is the way it must be done :slight_smile: