[Vtigercrm-developers] Importing records

Alan Lord alanslists at gmail.com
Mon Jul 27 07:13:03 GMT 2015


On 27/07/15 00:43, Hamono, Chris (DPC) wrote:
> Won’t manual import risk data integrity problems?
>
> I have never done it because a manual import (direct to db) does not
> trigger other scripts. So if you have a module that relies on events to
> fire on save or even workflows that need to run, a manual import does
> not do them.

Use the Server APIs (this is not direct database insertion) - if you do 
*not* set the global VAR "$VTIGER_BULK_SAVE_MODE" to true then using 
vtws_create/revise etc. will trigger Events etc.

> This is an issue I am about to encounter as I need to import data into
> two separate vtiger instances one is some 57,000 assets and the other is
> around 30,000 tickets into a highly customised ticket module.

Script it. Use the server APIs. If it's a large data import what I do is 
to run my import script from a bash wrapper which loops. It helps with 
memory starvation and also means (if you log properly) you can restart 
your process from where you left off it is does crash, rather than 
having to start again...

Example bash wrapper:

> for i in {0..500000..5000}
> do
>     echo "#3 $i..."
> 	sudo -u www-data php -f post-migration/account-migration-3.php ${i} > ${LOGDIR}/account-migration-3-${i}.log
> done





More information about the vtigercrm-developers mailing list