insert into ad_module select AD_MODULE_ID , AD_CLIENT_ID , AD_ORG_ID , ISACTIVE , CREATED , CREATEDBY , UPDATED , UPDATEDBY , NAME , VERSION , DESCRIPTION , HELP , URL , TYPE , LICENSE , ISINDEVELOPMENT , ISDEFAULT , SEQNO , JAVAPACKAGE , LICENSETYPE , AUTHOR , STATUS , UPDATE_AVAILABLE , ISTRANSLATIONREQUIRED, AD_LANGUAGE , HASCHARTOFACCOUNTS , ISTRANSLATIONMODULE , HASREFERENCEDATA , ISREGISTERED , UPDATEINFO , UPDATE_VER_ID , REFERENCEDATAINFO , VERSION_LABEL , VERSION_ID , ISCOMMERCIAL from ad_module_install i where not exists (select 1 from ad_module where ad_module_id = i.ad_module_id); insert into ad_module_dbprefix select AD_MODULE_DBPREFIX_ID, AD_CLIENT_ID , AD_ORG_ID , ISACTIVE , CREATED , CREATEDBY , UPDATED , UPDATEDBY , AD_MODULE_ID , NAME from ad_module_dbprefix_install i where not exists (select 1 from ad_module_dbprefix_install where ad_module_dbprefix_id = i.ad_module_dbprefix_id) ; insert into ad_module_dependency select AD_MODULE_DEPENDENCY_ID, AD_CLIENT_ID , AD_ORG_ID , ISACTIVE , CREATED , CREATEDBY , UPDATED , UPDATEDBY , AD_MODULE_ID , AD_DEPENDENT_MODULE_ID , STARTVERSION , ENDVERSION , ISINCLUDED , DEPENDANT_MODULE_NAME from ad_module_dependency_inst i where not exists (select 1 from ad_module_dependency where ad_module_dependency_id = i.ad_module_dependency_id); delete from ad_module_dependency_inst; delete from ad_module_dbprefix_install; delete from ad_module_install; update ad_module set status='A';