Liquibase error when upgrading the module
If in upgrading the reporting module you get a liquibase error, then you probably have the problem that the constraint in the database were saved with ?'s in it. To see if that's the case go into your database and type the following
SELECTÂ * FROMÂ Â Â INFORMATION_SCHEMA.KEY_COLUMN_USAGE KCU WHEREÂ Â KCU.TABLE_SCHEMA = database() ANDÂ Â Â Â KCU.TABLE_NAME = 'reporting_report_design';
Â
If you see ? in any of the names of the constraints then you have the problem. If you don't see any ?, then skip to part B
A. Here's the solution.
Â
Before anything, make a backup of your database in case something happens
1. mysqldump -uUSER -p DBNAME > dbBackup.sql
where USER is your mysql database user and DBNAME is the database name, probably openmrs
Â
Then fix the spaces and ? in the reporting_report_design table by doing the following
1. mysqldump -uUSER -p DBNAME reporting_report_design > reportTable.sql
where USER is your mysql database user and DBNAME is the database name, probably openmrs
Â
2. Edit the reportTable.sql file with a text editor such as nano or notepad. Change only the following lines, otherwise you might lose your data
 CONSTRAINT `changed_by?for?reporting_report_design` FOREIGN KEY (`changed_by`) REFERENCES `users` (`user_id`),
 CONSTRAINT `creator?for?reporting_report_design` FOREIGN KEY (`creator`) REFERENCES `users` (`user_id`),
 CONSTRAINT `report_definition_id?for?reporting_report_design` FOREIGN KEY (`report_definition_id`) REFERENCES `serialized_object` (`serialized_object_id`),
 CONSTRAINT `retired_by?for?reporting_report_design` FOREIGN KEY (`retired_by`) REFERENCES `users` (`user_id`)
Â
to the following
 CONSTRAINT `changed_by_for_reporting_report_design` FOREIGN KEY (`changed_by`) REFERENCES `users` (`user_id`),
 CONSTRAINT `creator_for_reporting_report_design` FOREIGN KEY (`creator`) REFERENCES `users` (`user_id`),
 CONSTRAINT `report_definition_id_for_reporting_report_design` FOREIGN KEY (`report_definition_id`) REFERENCES `serialized_object` (`serialized_object_id`),
 CONSTRAINT `retired_by_for_reporting_report_design` FOREIGN KEY (`retired_by`) REFERENCES `users` (`user_id`)
Â
4.Put the information back into your database
mysql -uUSER -p DBNAME < reportTable.sql
Â
B. Removing foreign key constraints
Now that the table is working fine, drop the restrictions that are causing the error. You may need to change the order of these statements.
alter table reporting_report_design drop foreign key report_definition_id_for_reporting_report_design;
alter table reporting_report_design drop key `report_definition_id for reporting_report_design`;
Â
Â
Now restart the module and it should work.