[Vtigercrm-commits] [vtiger-commits] r10062 - /vtigercrm/branches/5.0.3/modules/Migration/DBChanges/502_to_503.php

vtigercrm-commits at vtiger.fosslabs.com vtigercrm-commits at vtiger.fosslabs.com
Mon Jan 15 02:37:35 EST 2007


Author: richie
Date: Mon Jan 15 00:37:31 2007
New Revision: 10062

Log:
* Added queries to save the existing product-contact relationship 

Modified:
    vtigercrm/branches/5.0.3/modules/Migration/DBChanges/502_to_503.php

Modified: vtigercrm/branches/5.0.3/modules/Migration/DBChanges/502_to_503.php
==============================================================================
--- vtigercrm/branches/5.0.3/modules/Migration/DBChanges/502_to_503.php (original)
+++ vtigercrm/branches/5.0.3/modules/Migration/DBChanges/502_to_503.php Mon Jan 15 00:37:31 2007
@@ -75,7 +75,11 @@
 
 //Changes related to Product - Lead/Account/Contact/Potential relationship - Mickie - 13-01-2007
 ExecuteQuery("delete from vtiger_field where tabid=14 and fieldname in ('parent_id','contact_id')");
+
+//Before drop the contactid from products, we have to save this product - contact relationship in seproductsrel table
+ExecuteQuery("insert into vtiger_seproductsrel (select contactid, productid from vtiger_products where contactid is not NULL)");
 ExecuteQuery("alter table vtiger_products drop column contactid");
+
 
 ExecuteQuery("insert into vtiger_relatedlists values(".$adb->getUniqueID('vtiger_relatedlists').",14,7,'get_leads',9,'Leads',0)");
 ExecuteQuery("insert into vtiger_relatedlists values(".$adb->getUniqueID('vtiger_relatedlists').",14,6,'get_accounts',10,'Accounts',0)");
@@ -83,7 +87,8 @@
 ExecuteQuery("insert into vtiger_relatedlists values(".$adb->getUniqueID('vtiger_relatedlists').",14,2,'get_opportunities',12,'Potentials',0)");
 
 ExecuteQuery("alter table vtiger_seproductsrel add column setype varchar(100)");
-
+//we have to update setype for all existing entries which will be NULL before execute the following query
+ExecuteQuery("update  vtiger_seproductsrel,vtiger_crmentity set vtiger_seproductsrel.setype=vtiger_crmentity.setype  where vtiger_crmentity.crmid=vtiger_seproductsrel.crmid");
 
 //echo "<br><font color='red'>&nbsp; 5.0.2 ==> 5.0.3 Database changes has been done.</font><br>";
 





More information about the vtigercrm-commits mailing list