← Back to team overview

dhis2-devs team mailing list archive

Re: Schema missing many unique constraints

 

Hi Lorill

This is known issue with older versions of DHIS 2 (it was a serious bug in
hibernate, which we use as our ORM layer).

Jason created a script that will add them back (but please know that there
might be conflicts, as uniqueness constraints are added)

I'm adding him in, as I don't have access to that script right now.. he can
hopefully share it

--
Morten

On Thu, Jul 23, 2015 at 4:22 AM, Lorill Crees <lcrees@xxxxxxxxxx> wrote:

> 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
>
> _______________________________________________
> Mailing list: https://launchpad.net/~dhis2-devs
> Post to     : dhis2-devs@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~dhis2-devs
> More help   : https://help.launchpad.net/ListHelp
>
>

Follow ups

References