Upgrading OpenMRS from 1.9.1 to 2.0.5 .

Platform WAR (for Enterprise): 2.0.5: Question: During the upgrading process of OpenMRS from version 1.9.1 to 2.0.5, I encountered an error. Initially I installed MySQL 5.6.36 with Tomcat 7.0.77, Java 6, and openmrs 1.9.1 after running successfully, I stopped all modules and undeployed openmrs 1.9.1, upgrading Java to JAVA 8, then deploying openmrs 2.0.5. After restarting Tomcat the following errors were produced: INFO 5/12/17 11:35 AM:liquibase: Reading from liquibasechangelog SEVERE 5/12/17 11:35 AM:liquibase: Change Set liquibase-update-to-latest.xml::1-increase-privilege-col-size-privilege::dkayiwa failed. Error: Error executing SQL ALTER TABLE person_attribute_type DROP FOREIGN KEY privilege_which_can_edit: Can’t DROP ‘privilege_which_can_edit’; check that column/key exists liquibase.exception.DatabaseException: Error executing SQL ALTER TABLE person_attribute_type DROP FOREIGN KEY privilege_which_can_edit: Can’t DROP ‘privilege_which_can_edit’; check that column/key exists 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:189) at liquibase.changelog.ChangeLogIterator.run(ChangeLogIterator.java:58) at org.openmrs.util.DatabaseUpdater.executeChangelog(DatabaseUpdater.java:218) at org.openmrs.util.DatabaseUpdater.executeChangelog(DatabaseUpdater.java:148) at org.openmrs.web.filter.update.UpdateFilter$UpdateFilterCompletion$1.run(UpdateFilter.java:736) at java.lang.Thread.run(Thread.java:745) Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Can’t DROP ‘privilege_which_can_edit’; check that column/key exists at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:423) 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:1054) 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) … 11 more INFO 5/12/17 11:35 AM:liquibase: Successfully released change log lock ERROR - UpdateFilter$UpdateFilterCompletion$1.run(753) |2017-05-12 11:35:52,416| Unable to update the database org.openmrs.util.DatabaseUpdateException: There was an error while updating the database to the latest. file: liquibase-update-to-latest.xml. Error: Migration failed for change set liquibase-update-to-latest.xml::1-increase-privilege-col-size-privilege::dkayiwa: Reason: liquibase.exception.DatabaseException: Error executing SQL ALTER TABLE person_attribute_type DROP FOREIGN KEY privilege_which_can_edit: Can’t DROP ‘privilege_which_can_edit’; check that column/key exists: Caused By: Error executing SQL ALTER TABLE person_attribute_type DROP FOREIGN KEY privilege_which_can_edit: Can’t DROP ‘privilege_which_can_edit’; check that column/key exists: Caused By: Can’t DROP ‘privilege_which_can_edit’; check that column/key exists at org.openmrs.util.DatabaseUpdater.executeChangelog(DatabaseUpdater.java:152) at org.openmrs.web.filter.update.UpdateFilter$UpdateFilterCompletion$1.run(UpdateFilter.java:736) at java.lang.Thread.run(Thread.java:745) Caused by: liquibase.exception.MigrationFailedException: Migration failed for change set liquibase-update-to-latest.xml::1-increase-privilege-col-size-privilege::dkayiwa: Reason: liquibase.exception.DatabaseException: Error executing SQL ALTER TABLE person_attribute_type DROP FOREIGN KEY privilege_which_can_edit: Can’t DROP ‘privilege_which_can_edit’; check that column/key exists: Caused By: Error executing SQL ALTER TABLE person_attribute_type DROP FOREIGN KEY privilege_which_can_edit: Can’t DROP ‘privilege_which_can_edit’; check that column/key exists: Caused By: Can’t DROP ‘privilege_which_can_edit’; check that column/key exists at liquibase.changelog.ChangeSet.execute(ChangeSet.java:347) at liquibase.changelog.visitor.UpdateVisitor.visit(UpdateVisitor.java:27) at org.openmrs.util.DatabaseUpdater$1OpenmrsUpdateVisitor.visit(DatabaseUpdater.java:189) at liquibase.changelog.ChangeLogIterator.run(ChangeLogIterator.java:58) at org.openmrs.util.DatabaseUpdater.executeChangelog(DatabaseUpdater.java:218) at org.openmrs.util.DatabaseUpdater.executeChangelog(DatabaseUpdater.java:148) … 2 more Caused by: liquibase.exception.DatabaseException: Error executing SQL ALTER TABLE person_attribute_type DROP FOREIGN KEY privilege_which_can_edit: Can’t DROP ‘privilege_which_can_edit’; check that column/key exists 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) … 7 more Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Can’t DROP ‘privilege_which_can_edit’; check that column/key exists at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:423) 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:1054) 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) … 11 more INFO 5/12/17 11:35 AM:liquibase: Reading from liquibasechangelog WARNING 5/12/17 11:35 AM:liquibase: modifyDataType will lose primary key/autoincrement/not null settings for mysql. Use and re-specify all configuration if this is the case WARNING 5/12/17 11:35 AM:liquibase: modifyDataType will lose primary key/autoincrement/not null settings for mysql. Use and re-specify all configuration if this is the case WARNING 5/12/17 11:35 AM:liquibase: modifyDataType will lose primary key/autoincrement/not null settings for mysql. Use and re-specify all configuration if this is the case

Try add a foreign key constraint with name “privilege_which_can_edit” to the “person_attribute_type” table and then run again. For the foreign key constraint, referencedTableName=“privilege” and referencedColumnName=“privilege”

After successfully solved the previous error, another error produced.

INFO 5/12/17 2:56 PM:liquibase: ChangeSet liquibase-update-to-latest.xml::20121016-1504::wyclif ran successfully in 502ms SEVERE 5/12/17 2:56 PM:liquibase: Change Set liquibase-update-to-latest.xml::20121020-TRUNK-3610::lluismf failed. Error: Error executing SQL UPDATE global_property SET property = ‘visits.autoCloseVisitType’ WHERE property=‘autoCloseVisits.visitType’: Duplicate entry ‘visits.autoCloseVisitType’ for key ‘PRIMARY’ liquibase.exception.DatabaseException: Error executing SQL UPDATE global_property SET property = ‘visits.autoCloseVisitType’ WHERE property=‘autoCloseVisits.visitType’: Duplicate entry ‘visits.autoCloseVisitType’ for key ‘PRIMARY’ 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:189) at liquibase.changelog.ChangeLogIterator.run(ChangeLogIterator.java:58) at org.openmrs.util.DatabaseUpdater.executeChangelog(DatabaseUpdater.java:218) at org.openmrs.util.DatabaseUpdater.executeChangelog(DatabaseUpdater.java:148) at org.openmrs.web.filter.update.UpdateFilter$UpdateFilterCompletion$1.run(UpdateFilter.java:736) at java.lang.Thread.run(Thread.java:745) Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Duplicate entry ‘visits.autoCloseVisitType’ for key ‘PRIMARY’ at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:423) 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) … 11 more INFO 5/12/17 2:56 PM:liquibase: Successfully released change log lock ERROR - UpdateFilter$UpdateFilterCompletion$1.run(753) |2017-05-12 14:56:29,099| Unable to update the database org.openmrs.util.DatabaseUpdateException: There was an error while updating the database to the latest. file: liquibase-update-to-latest.xml. Error: Migration failed for change set liquibase-update-to-latest.xml::20121020-TRUNK-3610::lluismf: Reason: liquibase.exception.DatabaseException: Error executing SQL UPDATE global_property SET property = ‘visits.autoCloseVisitType’ WHERE property=‘autoCloseVisits.visitType’: Duplicate entry ‘visits.autoCloseVisitType’ for key ‘PRIMARY’: Caused By: Error executing SQL UPDATE global_property SET property = ‘visits.autoCloseVisitType’ WHERE property=‘autoCloseVisits.visitType’: Duplicate entry ‘visits.autoCloseVisitType’ for key ‘PRIMARY’: Caused By: Duplicate entry ‘visits.autoCloseVisitType’ for key ‘PRIMARY’ at org.openmrs.util.DatabaseUpdater.executeChangelog(DatabaseUpdater.java:152) at org.openmrs.web.filter.update.UpdateFilter$UpdateFilterCompletion$1.run(UpdateFilter.java:736) at java.lang.Thread.run(Thread.java:745) Caused by: liquibase.exception.MigrationFailedException: Migration failed for change set liquibase-update-to-latest.xml::20121020-TRUNK-3610::lluismf: Reason: liquibase.exception.DatabaseException: Error executing SQL UPDATE global_property SET property = ‘visits.autoCloseVisitType’ WHERE property=‘autoCloseVisits.visitType’: Duplicate entry ‘visits.autoCloseVisitType’ for key ‘PRIMARY’: Caused By: Error executing SQL UPDATE global_property SET property = ‘visits.autoCloseVisitType’ WHERE property=‘autoCloseVisits.visitType’: Duplicate entry ‘visits.autoCloseVisitType’ for key ‘PRIMARY’: Caused By: Duplicate entry ‘visits.autoCloseVisitType’ for key ‘PRIMARY’ at liquibase.changelog.ChangeSet.execute(ChangeSet.java:347) at liquibase.changelog.visitor.UpdateVisitor.visit(UpdateVisitor.java:27) at org.openmrs.util.DatabaseUpdater$1OpenmrsUpdateVisitor.visit(DatabaseUpdater.java:189) at liquibase.changelog.ChangeLogIterator.run(ChangeLogIterator.java:58) at org.openmrs.util.DatabaseUpdater.executeChangelog(DatabaseUpdater.java:218) at org.openmrs.util.DatabaseUpdater.executeChangelog(DatabaseUpdater.java:148) … 2 more Caused by: liquibase.exception.DatabaseException: Error executing SQL UPDATE global_property SET property = ‘visits.autoCloseVisitType’ WHERE property=‘autoCloseVisits.visitType’: Duplicate entry ‘visits.autoCloseVisitType’ for key ‘PRIMARY’ 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) … 7 more Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Duplicate entry ‘visits.autoCloseVisitType’ for key ‘PRIMARY’ at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:423) 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) … 11 more

In your global_property table, delete the row where property = visits.autoCloseVisitType Then try again.

Thanks, Additional error;

SEVERE 5/12/17 3:13 PM:liquibase: Change Set liquibase-update-to-latest.xml::201306141103-TRUNK-3884::susantan failed. Error: Error executing SQL ALTER TABLE encounter_provider ADD CONSTRAINT encounter_provider_creator FOREIGN KEY (creator) REFERENCES users (user_id): Cannot add or update a child row: a foreign key constraint fails (openmrs.#sql-8623_15d, CONSTRAINT encounter_provider_creator FOREIGN KEY (creator) REFERENCES users (user_id)) liquibase.exception.DatabaseException: Error executing SQL ALTER TABLE encounter_provider ADD CONSTRAINT encounter_provider_creator FOREIGN KEY (creator) REFERENCES users (user_id): Cannot add or update a child row: a foreign key constraint fails (openmrs.#sql-8623_15d, CONSTRAINT encounter_provider_creator FOREIGN KEY (creator) REFERENCES users (user_id)) 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:189) at liquibase.changelog.ChangeLogIterator.run(ChangeLogIterator.java:58) at org.openmrs.util.DatabaseUpdater.executeChangelog(DatabaseUpdater.java:218) at org.openmrs.util.DatabaseUpdater.executeChangelog(DatabaseUpdater.java:148) at org.openmrs.web.filter.update.UpdateFilter$UpdateFilterCompletion$1.run(UpdateFilter.java:736) at java.lang.Thread.run(Thread.java:745) Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Cannot add or update a child row: a foreign key constraint fails (openmrs.#sql-8623_15d, CONSTRAINT encounter_provider_creator FOREIGN KEY (creator) REFERENCES users (user_id)) at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:423) 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) … 11 more INFO 5/12/17 3:13 PM:liquibase: Successfully released change log lock ERROR - UpdateFilter$UpdateFilterCompletion$1.run(753) |2017-05-12 15:13:00,465| Unable to update the database org.openmrs.util.DatabaseUpdateException: There was an error while updating the database to the latest. file: liquibase-update-to-latest.xml. Error: Migration failed for change set liquibase-update-to-latest.xml::201306141103-TRUNK-3884::susantan: Reason: liquibase.exception.DatabaseException: Error executing SQL ALTER TABLE encounter_provider ADD CONSTRAINT encounter_provider_creator FOREIGN KEY (creator) REFERENCES users (user_id): Cannot add or update a child row: a foreign key constraint fails (openmrs.#sql-8623_15d, CONSTRAINT encounter_provider_creator FOREIGN KEY (creator) REFERENCES users (user_id)): Caused By: Error executing SQL ALTER TABLE encounter_provider ADD CONSTRAINT encounter_provider_creator FOREIGN KEY (creator) REFERENCES users (user_id): Cannot add or update a child row: a foreign key constraint fails (openmrs.#sql-8623_15d, CONSTRAINT encounter_provider_creator FOREIGN KEY (creator) REFERENCES users (user_id)): Caused By: Cannot add or update a child row: a foreign key constraint fails (openmrs.#sql-8623_15d, CONSTRAINT encounter_provider_creator FOREIGN KEY (creator) REFERENCES users (user_id)) at org.openmrs.util.DatabaseUpdater.executeChangelog(DatabaseUpdater.java:152) at org.openmrs.web.filter.update.UpdateFilter$UpdateFilterCompletion$1.run(UpdateFilter.java:736) at java.lang.Thread.run(Thread.java:745) Caused by: liquibase.exception.MigrationFailedException: Migration failed for change set liquibase-update-to-latest.xml::201306141103-TRUNK-3884::susantan: Reason: liquibase.exception.DatabaseException: Error executing SQL ALTER TABLE encounter_provider ADD CONSTRAINT encounter_provider_creator FOREIGN KEY (creator) REFERENCES users (user_id): Cannot add or update a child row: a foreign key constraint fails (openmrs.#sql-8623_15d, CONSTRAINT encounter_provider_creator FOREIGN KEY (creator) REFERENCES users (user_id)): Caused By: Error executing SQL ALTER TABLE encounter_provider ADD CONSTRAINT encounter_provider_creator FOREIGN KEY (creator) REFERENCES users (user_id): Cannot add or update a child row: a foreign key constraint fails (openmrs.#sql-8623_15d, CONSTRAINT encounter_provider_creator FOREIGN KEY (creator) REFERENCES users (user_id)): Caused By: Cannot add or update a child row: a foreign key constraint fails (openmrs.#sql-8623_15d, CONSTRAINT encounter_provider_creator FOREIGN KEY (creator) REFERENCES users (user_id)) at liquibase.changelog.ChangeSet.execute(ChangeSet.java:347) at liquibase.changelog.visitor.UpdateVisitor.visit(UpdateVisitor.java:27) at org.openmrs.util.DatabaseUpdater$1OpenmrsUpdateVisitor.visit(DatabaseUpdater.java:189) at liquibase.changelog.ChangeLogIterator.run(ChangeLogIterator.java:58) at org.openmrs.util.DatabaseUpdater.executeChangelog(DatabaseUpdater.java:218) at org.openmrs.util.DatabaseUpdater.executeChangelog(DatabaseUpdater.java:148) … 2 more Caused by: liquibase.exception.DatabaseException: Error executing SQL ALTER TABLE encounter_provider ADD CONSTRAINT encounter_provider_creator FOREIGN KEY (creator) REFERENCES users (user_id): Cannot add or update a child row: a foreign key constraint fails (openmrs.#sql-8623_15d, CONSTRAINT encounter_provider_creator FOREIGN KEY (creator) REFERENCES users (user_id)) 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) … 7 more Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Cannot add or update a child row: a foreign key constraint fails (openmrs.#sql-8623_15d, CONSTRAINT encounter_provider_creator FOREIGN KEY (creator) REFERENCES users (user_id)) at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:423) 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) … 11 more

??? Caused By: Cannot add or update a child row: a foreign key constraint fails (`openmrs`.`#sql-8623_2b0`, CONSTRAINT `encounter_provider_creator` FOREIGN KEY (`creator`) REFERENCES `users` (`user_id`))???
???There was an error while updating the database to the latest. file: liquibase-update-to-latest.xml. Error: Migration failed for change set liquibase-update-to-latest.xml::201306141103-TRUNK-3884::susantan:???
??? Caused By: Error executing SQL ALTER TABLE `encounter_provider` ADD CONSTRAINT `encounter_provider_creator` FOREIGN KEY (`creator`) REFERENCES `users` (`user_id`): Cannot add or update a child row: a foreign key constraint fails (`openmrs`.`#sql-8623_2b0`, CONSTRAINT `encounter_provider_creator` FOREIGN KEY (`creator`) REFERENCES `users` (`user_id`)):???
Unable to update the database. See server error logs for the full stacktrace.
??? Reason: liquibase.exception.DatabaseException: Error executing SQL ALTER TABLE `encounter_provider` ADD CONSTRAINT `encounter_provider_creator` FOREIGN KEY (`creator`) REFERENCES `users` (`user_id`): Cannot add or update a child row: a foreign key constraint fails (`openmrs`.`#sql-8623_2b0`, CONSTRAINT `encounter_provider_creator` FOREIGN KEY (`creator`) REFERENCES `users` (`user_id`)):???

Can you paste the complete stack trace at pastebin.com?

https://pastebin.com/VJYUzLsY

Can you check your “encounter_provider” table to see if you have any “creator” value that is not in the “users” table?

Yes, there is “creator” value that is not in the “users” table

Can you give it a value that exists and then try again?

Thank you Daniel, your solutions has been successfully solved all errors. I will inform you on next step of upgrading existing and adding new modules if there will be any problem. Thank you once again