Error starting Chart Search module with MariaDB

I installed all 2.2 modules on OpenMRS running as WAR connected to MariaDB and all of them started ok except Chart Search. Here’ s the exception:

WARN - ModuleFactory.startModuleInternal(792) |2015-05-19 21:49:38,596| Error while trying to start module: chartsearch
**org.openmrs.module.ModuleException: Unable to update data model using liquibase.xml. Module: Chart Search Module**
	at org.openmrs.module.ModuleFactory.runLiquibase(
	at org.openmrs.module.ModuleFactory.startModuleInternal(
	at org.openmrs.api.context.Daemon$
Caused by: liquibase.exception.MigrationFailedException: Migration failed for change set liquibase.xml::4::Eli:
     Reason: liquibase.exception.DatabaseException: **Error executing SQL ALTER TABLE `chartsearch_synonyms` ADD CONSTRAINT `fk_synonymgroups_synonyms_cascade` FOREIGN KEY (`group_id`) REFERENCES `chartsearch_synonym_groups` (`group_id`) ON UPDATE CASCADE ON DELETE CASCADE: Can't create table 'openmrs.#sql-f48_64' (errno: 121):**

It looks like the cause is that there are 2 foreign keys for the same column. And they are contradictory (one has update cascade and the other restrict).

I had not noticed this before, I will be looking into the whole synonym group feature this summer during which I will address this incase it does not need to be addressed argently.

There’s a JIRA ticket for that. The fix is simple, drop + create the FK.