diff --git a/modules/Migration/schema/660_to_700.php b/modules/Migration/schema/660_to_700.php
index bd78c8a2cabace32fd385ad167c6fa7f7137fec7..aa55fd77de7ddaacc26d27e5a03c4f8135002293 100644
--- a/modules/Migration/schema/660_to_700.php
+++ b/modules/Migration/schema/660_to_700.php
@@ -2215,7 +2215,10 @@ if(defined('VTIGER_UPGRADE')) {
 					}
 				}
 			}
-			$db->pquery("DELETE FROM $baseTableName WHERE $baseTableIndex NOT IN (SELECT crmid FROM vtiger_crmentity WHERE setype=?)", array($moduleName));
+            if($baseTableName == 'vtiger_activity'){
+                array_push($moduleName, "Emails");
+            }
+			$db->pquery("DELETE FROM $baseTableName WHERE $baseTableIndex NOT IN (SELECT crmid FROM vtiger_crmentity WHERE setype in ". generateQuestionMarks($moduleName).")", array($moduleName));
 		}
 	}