error upgrading Openmrs 1.8.4 to Openmrs 1.9.8

8 views
Skip to first unread message

Dugan, Tammy Marie

unread,
Apr 8, 2015, 2:31:32 PM4/8/15
to OpenMRS Developers
I get the following error when I try to upgrade between 1.8.4 and 1.9.8
(downloaded from the openmrs download sight):

SEVERE 4/8/15 2:27 PM:liquibase: Change Set
liquibase-update-to-latest.xml::20110708-2105::cta failed. Error: Error
executing SQL ALTER TABLE `concept_source` ADD CONSTRAINT
`concept_source_unique_hl7_codes` UNIQUE (`hl7_code`): Duplicate entry '
' for key 'concept_source_unique_hl7_codes'
liquibase.exception.DatabaseException: Error executing SQL ALTER TABLE
`concept_source` ADD CONSTRAINT `concept_source_unique_hl7_codes` UNIQUE
(`hl7_code`): Duplicate entry ' ' for key 'concept_source_unique_hl7_codes'
at liquibase.executor.jvm.JdbcExecutor.execute(JdbcExecutor.java:62)
at liquibase.executor.jvm.JdbcExecutor.execute(JdbcExecutor.java:104)
at liquibase.database.AbstractDatabase.execute(AbstractDatabase.java:1091)
at
liquibase.database.AbstractDatabase.executeStatements(AbstractDatabase.java:1075)
at liquibase.changelog.ChangeSet.execute(ChangeSet.java:317)
at liquibase.changelog.visitor.UpdateVisitor.visit(UpdateVisitor.java:27)
at
org.openmrs.util.DatabaseUpdater$1OpenmrsUpdateVisitor.visit(DatabaseUpdater.java:202)
at liquibase.changelog.ChangeLogIterator.run(ChangeLogIterator.java:58)
at
org.openmrs.util.DatabaseUpdater.executeChangelog(DatabaseUpdater.java:231)
at
org.openmrs.util.DatabaseUpdater.executeChangelog(DatabaseUpdater.java:167)
at
org.openmrs.util.DatabaseUpdater.executeChangelog(DatabaseUpdater.java:152)
at
org.openmrs.util.DatabaseUpdater.executeChangelog(DatabaseUpdater.java:115)
at
org.openmrs.util.DatabaseUpdater.executeChangelog(DatabaseUpdater.java:98)
at
org.openmrs.api.context.Context.checkForDatabaseUpdates(Context.java:1116)
at org.openmrs.api.context.Context.startup(Context.java:827)
at org.openmrs.web.Listener.startOpenmrs(Listener.java:194)
at org.openmrs.web.WebDaemon$1.run(WebDaemon.java:46)
Caused by:
com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException:
Duplicate entry ' ' for key 'concept_source_unique_hl7_codes'
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at
sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at com.mysql.jdbc.Util.handleNewInstance(Util.java:411)
at com.mysql.jdbc.Util.getInstance(Util.java:386)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1041)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4237)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4169)
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2617)
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2778)
at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2819)
at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2768)
at com.mysql.jdbc.StatementImpl.execute(StatementImpl.java:949)
at com.mysql.jdbc.StatementImpl.execute(StatementImpl.java:795)
at
liquibase.executor.jvm.JdbcExecutor$1ExecuteStatementCallback.doInStatement(JdbcExecutor.java:92)
at liquibase.executor.jvm.JdbcExecutor.execute(JdbcExecutor.java:55)
... 16 more

Burke Mamlin

unread,
Apr 8, 2015, 2:36:53 PM4/8/15
to d...@openmrs.org
My guess – either the upgrade is mistakenly referencing "concept_source" instead of "concept_reference_source" or you have duplicate values in concept_reference_source.hl7_code attribute.

-Burke


--
OpenMRS Developers: http://om.rs/dev
Post: d...@openmrs.org | Unsubscribe: dev+uns...@openmrs.org
Manage your OpenMRS subscriptions: http://om.rs/id

*** FINAL WARNING: This group will be moved to OpenMRS Talk effective 10 April 2015 at 19:00 UTC. Please visit https://talk.openmrs.org/t/openmrs-developers-group-changes-2015-04-10/1508 for details and to make necessary changes.

Dugan, Tammy Marie

unread,
Apr 8, 2015, 2:43:36 PM4/8/15
to d...@openmrs.org
Attached is a dump of the data table. Am I getting this error because
some rows have a null hl7_code column?

Thanks,

Tammy
> Post: d...@openmrs.org <mailto:d...@openmrs.org> | Unsubscribe:
> dev+uns...@openmrs.org <mailto:dev%2Bunsu...@openmrs.org>
> Manage your OpenMRS subscriptions: http://om.rs/id
>
> *** FINAL WARNING: This group will be moved to OpenMRS Talk
> effective 10 April 2015 at 19:00 UTC. Please visit
> https://talk.openmrs.org/t/openmrs-developers-group-changes-2015-04-10/1508
> for details and to make necessary changes.
>
>
> --
> OpenMRS Developers: http://om.rs/dev
> Post: d...@openmrs.org | Unsubscribe: dev+uns...@openmrs.org
> Manage your OpenMRS subscriptions: http://om.rs/id
>
> *** FINAL WARNING: This group will be moved to OpenMRS Talk effective 10
> April 2015 at 19:00 UTC. Please visit
> https://talk.openmrs.org/t/openmrs-developers-group-changes-2015-04-10/1508
> for details and to make necessary changes.
>
> To unsubscribe from this group and stop receiving emails from it, send
> an email to dev+uns...@openmrs.org
> <mailto:dev+uns...@openmrs.org>.
CSVFile_2015-04-08T14_40_35.csv

Burke Mamlin

unread,
Apr 8, 2015, 3:06:44 PM4/8/15
to d...@openmrs.org
You definitely shouldn't have to populate hl7_source.  That field is optional and I've seen many servers running 1.9, 2.0, and above with blank HL7 source entries.

I'm confused by the error message:


SEVERE 4/8/15 2:27 PM:liquibase: Change Set
liquibase-update-to-latest.xml::20110708-2105::cta failed.  Error: Error
executing SQL ALTER TABLE `concept_source` ADD CONSTRAINT
`concept_source_unique_hl7_codes` UNIQUE (`hl7_code`): Duplicate entry '
' for key 'concept_source_unique_hl7_codes'
liquibase.exception.DatabaseException: Error executing SQL ALTER TABLE
`concept_source` ADD CONSTRAINT `concept_source_unique_hl7_codes` UNIQUE
(`hl7_code`): Duplicate entry ' ' for key 'concept_source_unique_hl7_codes'

Unless something has changed that I don't know about, there is no "concept_source" table.  It's called "concept_reference_source".  So, I'm not sure how it gets to the point of complaining of a duplicate entry on a unique index on a table that doesn't exist. :-/

Is the table called concept_source or concept_reference_source in your database?

-Burke

Dugan, Tammy Marie

unread,
Apr 8, 2015, 3:16:24 PM4/8/15
to d...@openmrs.org
Concept_source

Tammy

On 4/8/2015 3:06 PM, Burke Mamlin wrote:
> You definitely shouldn't have to populate hl7_source. That field is
> optional and I've seen many servers running 1.9, 2.0, and above with
> blank HL7 source entries.
>
> I'm confused by the error message:
>
> SEVERE 4/8/15 2:27 PM:liquibase: Change Set
> liquibase-update-to-latest.xml::20110708-2105::cta failed. Error: Error
> executing SQL ALTER TABLE *`concept_source`* ADD CONSTRAINT
> <mailto:d...@openmrs.org <mailto:d...@openmrs.org>> | Unsubscribe:
> > dev+uns...@openmrs.org
> <mailto:dev%2Bunsu...@openmrs.org>
> <mailto:dev%2Bunsu...@openmrs.org
> <mailto:dev%252Buns...@openmrs.org>>
> > Manage your OpenMRS subscriptions: http://om.rs/id
> >
> > *** FINAL WARNING: This group will be moved to OpenMRS Talk
> > effective 10 April 2015 at 19:00 UTC. Please visit
> > https://talk.openmrs.org/t/openmrs-developers-group-changes-2015-04-10/1508
> > for details and to make necessary changes.
> >
> >
> > --
> > OpenMRS Developers: http://om.rs/dev
> > Post: d...@openmrs.org <mailto:d...@openmrs.org> | Unsubscribe:
> dev+uns...@openmrs.org <mailto:dev%2Bunsu...@openmrs.org>
> > Manage your OpenMRS subscriptions: http://om.rs/id
> >
> > *** FINAL WARNING: This group will be moved to OpenMRS Talk effective 10
> > April 2015 at 19:00 UTC. Please visit
> > https://talk.openmrs.org/t/openmrs-developers-group-changes-2015-04-10/1508
> > for details and to make necessary changes.
> >
> > To unsubscribe from this group and stop receiving emails from it, send
> > an email to dev+uns...@openmrs.org
> <mailto:dev%2Bunsu...@openmrs.org>
> > <mailto:dev+uns...@openmrs.org
> <mailto:dev%2Bunsu...@openmrs.org>>.

Lluis Martinez

unread,
Apr 8, 2015, 4:02:26 PM4/8/15
to d...@openmrs.org
The unique constraint was created here

<changeSet id="20110708-2105" author="cta" dbms="mysql">
<preConditions onFail="MARK_RAN">
<not>
<indexExists indexName="concept_source_unique_hl7_codes" />
</not>
</preConditions>
<comment>
Add unique constraint to the concept_source table
</comment>
<addUniqueConstraint tableName="concept_source" columnNames="hl7_code" constraintName="concept_source_unique_hl7_codes"/>
</changeSet>

And the table renamed later 

<changeSet id="20110301-1030a" author="wyclif" dbms="mysql">
<preConditions onFail="MARK_RAN">
<and>
<not><tableExists tableName="concept_reference_source" /></not>
</and>
</preConditions>
<comment>Renaming the concept_source table to concept_reference_source</comment>
<renameTable oldTableName="concept_source" newTableName="concept_reference_source"/>
</changeSet>

But AFAIK null values do not count for uniqueness. If they contain spaces, try setting them to null before updating.

Cheers





To unsubscribe from this group and stop receiving emails from it, send an email to dev+uns...@openmrs.org.

Dugan, Tammy Marie

unread,
Apr 9, 2015, 9:42:50 AM4/9/15
to d...@openmrs.org
Thank you, Luis. Replacing empty strings with nulls took care of the error.

Tammy
> > <mailto:dev%2Bunsu...@openmrs.org
> <mailto:dev%252Buns...@openmrs.org>
> > <mailto:dev%252Buns...@openmrs.org
> <mailto:dev%25252Bun...@openmrs.org>>>
> > > Manage your OpenMRS subscriptions: http://om.rs/id
> > >
> > > *** FINAL WARNING: This group will be moved to OpenMRS Talk
> > > effective 10 April 2015 at 19:00 UTC. Please visit
> > > https://talk.openmrs.org/t/openmrs-developers-group-changes-2015-04-10/1508
> > > for details and to make necessary changes.
> > >
> > >
> > > --
> > > OpenMRS Developers: http://om.rs/dev
> > > Post: d...@openmrs.org <mailto:d...@openmrs.org> <mailto:d...@openmrs.org
> <mailto:d...@openmrs.org>> | Unsubscribe:
> > dev+uns...@openmrs.org <mailto:dev%2Bunsu...@openmrs.org>
> <mailto:dev%2Bunsu...@openmrs.org
> <mailto:dev%252Buns...@openmrs.org>>
> > > Manage your OpenMRS subscriptions: http://om.rs/id
> > >
> > > *** FINAL WARNING: This group will be moved to OpenMRS Talk effective 10
> > > April 2015 at 19:00 UTC. Please visit
> > > https://talk.openmrs.org/t/openmrs-developers-group-changes-2015-04-10/1508
> > > for details and to make necessary changes.
> > >
> > > To unsubscribe from this group and stop receiving emails from it, send
> > > an email to dev+uns...@openmrs.org <mailto:dev%2Bunsu...@openmrs.org>
> > <mailto:dev%2Bunsu...@openmrs.org
> <mailto:dev%252Buns...@openmrs.org>>
> > > <mailto:dev+uns...@openmrs.org
> <mailto:dev%2Bunsu...@openmrs.org>
> > <mailto:dev%2Bunsu...@openmrs.org
> <mailto:dev%252Buns...@openmrs.org>>>.
> To unsubscribe from this group and stop receiving emails from it,
> send an email to dev+uns...@openmrs.org
> <mailto:dev%2Bunsu...@openmrs.org>.
>
>
> --
> OpenMRS Developers: http://om.rs/dev
> Post: d...@openmrs.org | Unsubscribe: dev+uns...@openmrs.org
> Manage your OpenMRS subscriptions: http://om.rs/id
>
> *** FINAL WARNING: This group will be moved to OpenMRS Talk effective 10
> April 2015 at 19:00 UTC. Please visit
> https://talk.openmrs.org/t/openmrs-developers-group-changes-2015-04-10/1508
> for details and to make necessary changes.
>
> To unsubscribe from this group and stop receiving emails from it, send
> an email to dev+uns...@openmrs.org
> <mailto:dev+uns...@openmrs.org>.
Reply all
Reply to author
Forward
0 new messages