Downgrading AMP version in Alfresco

If you ever tried to downgrade an AMP version in Alfresco you should have seen an error something similar:

Caused by: org.alfresco.error.AlfrescoRuntimeException: 02100002

Downgrading of modules is not supported.

Module 'acme-cms-poc-repo-amp' version 1.0.1 is currently installed and must be uninstalled before version 1.0.0 can be installed. at org.alfresco.error.AlfrescoRuntimeException.create(AlfrescoRuntimeException.java:51) at org.alfresco.repo.module.ModuleComponentHelper.startModule(ModuleComponentHelper.java:632) at org.alfresco.repo.module.ModuleComponentHelper.access$500(ModuleComponentHelper.java:61) at org.alfresco.repo.module.ModuleComponentHelper$1$1.execute(ModuleComponentHelper.java:259) at org.alfresco.repo.transaction.RetryingTransactionHelper.doInTransaction(RetryingTransactionHelper.java:454) at org.alfresco.repo.transaction.RetryingTransactionHelper.doInTransaction(RetryingTransactionHelper.java:342) at org.alfresco.repo.module.ModuleComponentHelper$1.doWork(ModuleComponentHelper.java:280) ... 45 more

There are two ways to solve this issue:

1. Configuring a rule on a folder to execute script action.
2. Executing a SQL update statement directly on the DB.


Configuring a rule on a folder to execute script action.

var node = search.findNode("<nodeRef >");
node.properties["module:currentVersion"]="1.0.0";
node.save();

If you have the Javascript console installed then you may execute the above script directly on JSConsole

Executing a SQL update statement directly on the DB.

UPDATE alf_node_properties
LEFT JOIN (alf_qname, alf_namespace) ON (alf_node_properties.qname_id = alf_qname.id AND alf_qname.ns_id = alf_namespace.id)
SET alf_node_properties.string_value = "1.0.0"
WHERE alf_namespace.uri="http://www.alfresco.org/system/modules/1.0" AND alf_qname.local_name = "currentVersion" AND string_value = "1.0.1";