VirtueMart Forum

VirtueMart 2 + 3 + 4 => Installation, Migration & Upgrade => Topic started by: mbarry on January 15, 2014, 16:20:08 PM

Title: VM1 to VM2: Primary DB Table Keys not reset after Removal of Virtuemart Data
Post by: mbarry on January 15, 2014, 16:20:08 PM
VM 2.0.26a
Joomla 2.5.17

Scenario:
      Select DB Tools -> Remove Virtuemart Data
      Select DB Tools -> Install or if necessary update tables
     
Issue:
      Everytime the data from the VM tables are deleted the primary keys continue to increment from the previous entry
      As this is a migration and the tables are emptied completely, it makes no sense to retain primary key values or log entries of each deletion
      Instead of executing DELETE FROM suggest using TRUNCATE TABLE this allows the PRIMARY key to be reset between migration attempts and is much faster for large tables.
     
Solution:
      Replace DELETE FROM with TRUNCATE TABLE for all entries in uninstall_data.sql

      Also, removed the IF EXISTS from `#__virtuemart_paymentmethod_creditcards` as it doesn't work raising an SQL error

Affected files:
      administrator/components/com_virturemart/install/uninstall_data.sql