Brighid McDonnell
Brighid McDonnell

Reputation: 4343

Preserving the ID column in a Magento database migration

I am working on migrating a Magento 1.3 install to version 1.5 of Magento. Due to the complexities of the 1.3 install, the database is being migrated by an export/tweak/import process. Unfortunately, during the import step, the ID column for customers, orders, and products, is different from the old version's ID, and the differences result in non-trivial changes (i.e. a given order is not guaranteed to be attached to the same customer that it was before, an order is not guaranteed to consist of the same products as before).

How can we adjust our process so that either the ID column does not change, or so that the new state is internally consistent? - i.e. things in the DB may have different IDs than before, but a given order contains all of the same products that it did before and is attached to the same customer.

My first impulse is to try adding custom attributes to the rows in question and making them match the ID, then running a query on the post-migration database to restore the ID to the original value, but Magento's EAV data model makes this complicated, plus I'm not sure whether this will break the ability to add future products, orders, etc by putting IDs out of order. Is this plan viable?

Upvotes: 1

Views: 1009

Answers (1)

ShaunOReilly
ShaunOReilly

Reputation: 2206

I recommend using Unirgy's uRapidFlow tool - it can save you hours of trouble. We've used it for really big websites in the past.

Some of its features are:

  • Original extension includes product import/export (see add-ons for more data types)
  • Ignore empty or commented out rows
  • No internal entity IDs exported/needed
  • CSV file encoding per profile
  • Recognize and skip records that do not require update
  • Extensive data validation with detailed reporting
  • If row contains multiple errors and warnings, log them all
  • Import/export from/to remote location using FTP
  • Stable small footprint memory usage
  • Dry-run option to validate import file without changing data
  • When importing products, automatically create categories, attribute option values and attribute sets when needed (optional)
  • Automatically re-index catalog areas or refresh different cache types on profile completion, in any order
  • Export imported file as Excel spreadsheet with cell-by-cell marking of errors and warnings, with explanations
  • Import/export image files
  • Import image files directly from HTTP URLs
  • Single and batched scheduled sessions using cronjobs
  • Import/export profile configuration

Upvotes: 2

Related Questions