I am currently working on a ticket that should implement a DatabaseUpgradeTest for version 2.2.0. This test should validate if the changes in the data model, e. g. adding a new attribute, are really reflected in the created database. For version 1.9.7 there already exists an according test set on GitHub:
I now want to use a similar test as the one written by @raff above to test the databases changes for the upgrade to version 2.2.0. As the layout is similar to the upgrade test for 1.9.7. I need to create a H2.DB file, more precisley a file like openmrs-1.9.7.h2.db which will load an initial database. I have the following questions regarding this file:
This file should in my scenario represent the database at version 2.2.0 (as the name suggests) or the state of the previous version so that the changeset for 2.2.0 can yet be applied?
How can I create such a H2.db file in the first place? I could not find a way to do this in the MRS or online documentation. A link would be welcome as well
Do I actually need a new version of this or could I use the 1.9.7 for the execution of then newer test.
I can have a look into this next weekend. Then I will try to create the file and finalize the DatabaseUpgrade test as discussed in the Jira issue. I have the following two questions right now regarding this:
(1) Does it has to be a “dump” from the H2 database or could it also be from the MySQL database. Why was this databases chosen?
(2) I am having doubts about the execution of the SDK. The comment should be according to the documentation:
However, I have the feeling that it would also already execute the changsets that are currently part of the master. So my approach would be to clone the branch 2.1.X and then execute the SDK on that version (probably with the same command)?
Or is there a better approach to make sure only 2.1.X data is existing?
I do not get h2 shown as an option for selection. Only MySQL & Docker. My understanding is that this behaviour is based on on the fact that it is a reference Application (2.2.0). Therefore, I can’t use H2 on this. Any remarks/ideas how I can still get a H2 file from this version for the upgrade test?
If I install 2.2.0 I can use H2. I executed:
mvn openmrs-sdk:run -DserverId=webservices-dev
I requested to update the version while executing the 2.0.0 toolkit that was configured to use H2
The server currently has openmrs.war in version 2.0.0. Would you like to update it to 2.2.0-SNAPSHOT from the current directory? [Y/n]: Y
The execution logs on maven shows that the upgrade does have a lot failing conditions. Probably because 2.2.0 does not support H2?
Anyways: if I am copying the file to use this generated db file for the execution of the upgrade test I get the following error:
Unsupported database file version or invalid file header in file “/private/var/folders/02/hn40l_hs6ys_9rfmq_m3dfzr0000gn/T/openmrs-tests-temp-8019167480642612732/openmrs.h2.db” [90048-196]
I see the following options. Any ideas and thoughts on it?:
Use 2.2.0 to create H2 file and use this for testing although it is the wrong version