On downgrading the add-on to an earlier version 3.x you can encounter the following error:
java.sql.SQLException: Cannot drop index 'index_ao_d195e9_cus1061972428': needed in a foreign key constraint
If you encounter this problem you need to run the following script:
ALTER TABLE <<dbname>>.AO_D195E9_CUSTOM_MAIL_TEMPLATE DROP FOREIGN KEY fk_ao_d195e9_custom_mail_template_icon_id ; Commit;
The query above was written in MySQL syntax, so you may need to tweak it depending on the database you are using.