ITrack/Enterprise/Migrating Images From Pro To Enterprise
Purpose
This process will migrate part and vehicle pictures from a Pro install to an Enterprise install. There are two types of migrations: single-store and a multi-store merge. Single-store consists of just one store moving from Pro to Enterprise. A multi-store merge consists of one store being merged into a database with multiple stores. Some special considerations have to be made for multi-store merges.
Required
- Scripts located in <SVN>\trunk\ITrackEnterprise\Database\Scripts\Image Renaming\
- PHP
- Access to source and destination image directories
- A mysql connection to the Enterprise database
Part Images
Part images are formatted: <inventoryid>_<sequential image number>.jpg
Single-store
Part images can be straight copied over from Pro for single store migrations.
Merge
Part images for merging migrations need to be moved with a script because the first section of the file name must be incremented by some inventory id additive. For this use part-imagerename.php with the following modifications:
- Set $fromDirectory = 'your_path_to_source_images';
- Set $toDirectory = 'your_path_to_destination_images';
- Set $incrementBy = your_inventory_additive; If the inventory id additive is not known, you can use this statement to find it:
SELECT MIN(inventory.inventoryid) - 1 FROM itrackenterprise.inventory WHERE storeid = <store ID>;
- Save and run the PHP script.
Vehicle Images
Vehicle images are formatted: V<vehicleid>_<sequential image number>.jpg
Single-store
Vehicle images can be straight copied over from Pro for single store migrations.
Merge
Vehicle images for merging migrations need to be moved with a script because the first section of the file name must be incremented by some vehicle id additive. For this use vehicle-imagerename.php with the following modifications:
- Set $fromDirectory = 'your_path_to_source_images';
- Set $toDirectory = 'your_path_to_destination_images';
- Set $incrementBy = your_vehicle_additive; If the vehicle id additive is not known, you can use this statement to find it:
SELECT MIN(vehicle.vehicleid) - 1 FROM itrackenterprise.vehicle WHERE storeid = <storeid>;
- Save and run the PHP script.
Whole Unit Images
Single-store and Merge installs
One difference between Pro and Enterprise is Pro can have images attached to vehicles records and whole unit inventory records as well. Enterprise only uses vehicle images if the inventory record is a whole unit. This makes it necessary to rename some inventory images into vehicle images (<inventoryid>_<number>.jpg -> V<vehicleid>_<number>.jpg). For this you will use wholeUnit-mysqli.php with the following modifications:
- Set $fromDirectory = 'your_images';
- Set $toDirectory = 'your_images'; These two directories will typically be the same since you are renaming images but not moving them.
- Set $dbHost = 'mysql_host';
- Set $dbUser = 'mysql_user';
- Set $dbPassword = 'mysql_pass';
- Set $dbDatabase = 'itrackenterprise'; This typically will not change.
- Save and run the PHP script.
If the changes made by this script need to be rolled back they can by changing $doItBackwards = TRUE;
Finishing Up
Part and vehicle images should be confirmed in Enterprise.