[Vtigercrm-developers] vtlib module migration advice

Alan Lord alanslists at gmail.com
Tue Oct 1 13:32:49 UTC 2013


I've discovered a bit of a bug with the GeoTools module whereby the 
Primary index on the main table is not specific enough (spans three 
columns) which might result in duplicate entries in the vtiger_geotools 
table.

I can't write destructive SQL in the manifest.xml file so am assuming I 
will need to write a function in the module class triggered by either 
the "module.preupdate" or "module.postupdate" methods.

My question is which one of the two methods would be best to trigger my 
database change function?

Basically I need to do something like this:

> CREATE TABLE `temp_table` AS SELECT * FROM `vtiger_geotools` WHERE 1 GROUP BY geotoolsid;
> DROP TABLE `vtiger_geotools`;
> RENAME TABLE `temp_table` TO `vtiger_geotools`;
> ALTER TABLE `vtiger_geotools` DROP PRIMARY KEY;
> ALTER TABLE `vtiger_geotools` ADD PRIMARY KEY (`geotoolsid`);

Or does it not make much difference? I'm inclined to choose the 
postupdate personally.

Cheers

Al



More information about the vtigercrm-developers mailing list