Closed MzeeAlii closed 7 years ago
Which version of OpenMRS you are currently using?
I'm on OpenMRS v2.0.5. Cloned and built from source.
The current version on master branch is 1.x.x which was for openmrs 1.9.x to 1.11.x.
Could you try the branch/release 2.x.x of this module with your openmrs.
The error "Error while trying to start module Unable to update data model using liquibase.xml. Module: Team Management Module is due to liquibase discrepency. "
To reset your DB for new version
1 - Run query
SELECT * FROM openmrs.liquibasechangelog WHERE AUTHOR LIKE 'shak%';
2 - Delete row with ID column = teammodule-10.1.0A
3 - Drop table team_member_patient
Or alternatively reset your openmrs instance and install module 2.x.x again.
Tried to checkout branch 2.x.x, after build it the output was teammodule-2.0.0B.omod
then I did as you (@maimoonak) instructed i.e. reset my DB for new version.
At first SELECT * FROM openmrs.liquibasechangelog WHERE AUTHOR LIKE 'shak%';
gave 1 row, delete the row and drop the table (oh, there was no table team_member_patient
at all). Restarted my OpenMRS hoping the problem is gone but.. NOT! Still the very same error and the query returns 0 rows now (Empty set). Strange. :thinking:
Your modules screen might be looking like this
1- Delete/remove the module from openmrs 2- Restart openmrs 3- Run following on DB
DROP TABLE IF EXISTS `openmrs`.`member_location`;
DROP TABLE IF EXISTS `openmrs`.`team_lead`;
DROP TABLE IF EXISTS `openmrs`.`team_member_patient`;
DROP TABLE IF EXISTS `openmrs`.`team_member`;
DROP TABLE IF EXISTS `openmrs`.`team`;
DELETE FROM openmrs.liquibasechangelog where id like 'teammodule%';
4- Upload module 2.x.x again.
After uploading module it should look like this
Man, I did as you said and .... Voila! You genius.. Thanks @maimoonak (BIG TIME!) It's been a third day trying different ways to solve this.
Cool.
This sometimes happens with OpenMRS modules. Ideally liquibase existing changesets should never be modified and if there is a modification required, it should be added as a new and subsequent changeset.
Liquibase makes entries in table liquibasechangelog to keep track of executed changesets with a checksum/hash. When changeset is modified the checksum is found different and this error is encountered.
In above script we removed all tables created by previous version of team module, and also deleted all liquibase entries made by this module to allow module installation start from point zero. Offcourse, if it were production server, we never had deleted the tables. Also we never delete liquibase entries to avoid already executed changesets run again (this sometimes can also cause failed installations)
Copy that. :+1: Note taken.
Followed @maimoonak process, all DELETES found nothing safe for the one that calls for team table deletion, I got a foreign key checking error, had to do some dirty work of disabling the check, deleting the table and enabling back the checks. It worked!
mysql> DROP TABLE IF EXISTS `openmrs`.`team`;
ERROR 1217 (23000): Cannot delete or update a parent row: a foreign key constraint fails
mysql> SET FOREIGN_KEY_CHECKS=0;
Query OK, 0 rows affected (0.00 sec)
mysql> DROP TABLE IF EXISTS `openmrs`.`team`;
Query OK, 0 rows affected (0.01 sec)
mysql> SET FOREIGN_KEY_CHECKS=1;
Query OK, 0 rows affected (0.00 sec)
mysql> DELETE FROM openmrs.liquibasechangelog where id like 'teammodule%';
Query OK, 11 rows affected (0.03 sec)
I've tried to clone and build from sources and I had this error while trying to start the module. This was the error:
Unable to load/find moduleActivator:
'org.openmrs.module.teammodule.BasicModuleActivator' Module: Team Management Module
Then I tried to use the .omod file from Releases page: https://github.com/OpenSRP/opensrp-server/releases There's this new error now:
Error while trying to start module
Unable to update data model using liquibase.xml. Module: Team Management Module