← Back to team overview

dhis2-devs team mailing list archive

Schema missing many unique constraints

 

Hi,

We've noticed that many of our databases that have been upgraded from 2.18
to 2.19 and then to 2.20 are missing many of the unique constraints that
are present when creating a 2.20 database from a new install. I isolated
this issue to our upgrades from 2.18 to 2.19.

As a test I created 3 databases (Postgres 9.4.1, Tomcat 8.0.21, Java
1.8.0_31):

   1. I downloaded the 2.18 war, created database *dhis2_218, *then auto
   generated the schema by starting up the app
   2. I downloaded the 2.19 war, created database *dhis2_219, * then auto
   generated the schema by starting up the app
   3. I made a copy of dhis2_218 as *dhis2_219migrated*,  ran the upgrade
   script here:
   https://github.com/dhis2/dhis2-utils/blob/master/resources/sql/upgrade-219.sql,
   then ran the 2.19 war against it for it to be auto-updated
   (hibernate.hbm2ddl.auto = update).

Note that I did not populate any of these instances with data in this test.
When doing a schema diff between dhis2_219 and dhis2_219migrated, there are
a large number of differences in unique constraints and fk constraints (see
attached screenshot for a few examples: dhis2_219 is on the left and
dhis2_219migrated is on the right).

Is there a step in the migration I am missing here? We're trying to figure
out how to ensure our existing instances have the correct schema and
constraints for 2.20. We probably also have data clashes that won't conform
to the unique constraints that need to be added so need to deal with that
too.

Thanks,

Lorill

Attachment: Screen Shot 2015-07-22 at 2.03.37 PM.png
Description: PNG image


Follow ups