Managing Database migrations in development


(Kyle Nave) #1

I’ve been browsing the wiki and forum but haven’t quite found this info…

I see in versions.php where the database version is kept so I can tell how many changes there have been to the database between revisions, but how can I apply those to an existing installation?

The bigger question is I’m trying to figure out how to maintain a production site - benefit from ongoing updates (including my own) but not break things in the process.


(Kyle Nave) #2

OK - this was an academic question when I first posted but now its a bit more urgent.

I’m running up against Github Issue #2605 and apparently there is a solution already implemented. I would like to just grab a newer version and I know how I could update the YAML file to get the newer version but this wouldn’t make any required changes to the database schema… how do I execute migrations between OpenEMR versions?

Thanks,
Kyle


(Asher Densmore-Lynn) #3

If you’re using the docker containers and migrate to 5.0.2, I thought it did change the schema – happens when you spin the docker up, if it notices it doesn’t have the 5.0.2 flags in place. Can anybody verify that for me?


(Brady Miller) #4

hi @jesdynf ,

Yep, that is correct for going from version 5.0.1 to 5.0.2 .

Issue 2605 will be fixed in the first 5.0.2 patch, which will be released in several days (still have one more security fix to complete before can release it). Patches will not be auto updated like the version upgrade is. Patch will use the standard mechanism for dockers here: openemr-devops/packages/lightsail at master · openemr/openemr-devops · GitHub

-brady


(Kyle Nave) #5

I think the problem I’m having is that I started at some arbitrary point in time on the rel-502 branch… Not on any particular release. I have a fork with this particular commit preserved so I know where it is.

I would like to get from that point to the current 5.0.2 patch 1 somehow. I just tried to do it and broke things so thoroughly that I had to restore a backup of my server to get OpenEMR working again.

I was originally thinking I would maintain something like “the latest” branch of openemr along with my own customizations but now I see the folly in that and will probably stick with point releases and patches going forward.