Data Migration of the Commerce Server 2000/2002 Orders System

This topic discusses the changes that the Upgrade Wizard makes to Orders System data. The Upgrade Wizard migrates Order Templates, Baskets, and Purchase Orders from the Commerce Server 2002 table formats into the OrderTemplatesAndBaskets table and the new mapped storage tables. The changes that are made during migration to the OrderTemplatesAndBaskets table are controlled by the Transactions site resource. When you upgrade with the Upgrade Wizard, you can upgrade the Transactions resource or have the wizard ignore it.

In Commerce Server 2002, Basket class and OrderTemplate class instances are stored one order per row in the BasketGroup table of the Transactions resource by using the Component Object Model (COM) DBStorage object. The whole order dictionary is serialized as binary OLE structured storage and stored in the marshaled_data column. In Commerce Server 2007, Basket and OrderTemplate classes are also serialized to a binary form. However, they are stored in the marshaled_data column of the OrderTemplatesAndBaskets table using .NET binary serialization, not the COM DBStorage object.

Purchase orders in Commerce Server 2002 are saved to four tables by using the DBStorage object: OrderGroup, OrderFormHeader, OrderFormLineItems, and OrderGroupAddresses. In Commerce Server 2007, purchase order instances are stored by using a mechanism named mapped storage. This storage mechanism uses an XML mapping file to indicate how to translate managed class and collection hierarchies into a hierarchical set of tables that are linked by foreign-key relationships. Individual tables generally correspond to individual classes. For example, in the default Commerce Server 2007mapped storage file, purchase order instances are saved in the PurchaseOrders table, with each strongly typed property value becoming a column value. The order form collection on the purchase order becomes a set of rows in the OrderForms table. The line item collection in the OrderForms table becomes a set of rows in the LineItems table. This pattern is repeated for all the classes in the Orders class hierarchy.

Mapped storage also enables you to store weakly typed properties (which are name-value pairs similar to dictionary keys, available on many Orders classes) in their own columns. For example, if you use the weakly typed property ExtraTax in an order form to store a System.Decimal value that contains a custom tax amount, you can add a mapping entry to the XML mapped storage file to map that key to its own column in the OrderForms table.

Considerations for Migrating Orders System Data

When you migrate data in the Orders System to Commerce Server 2007, consider the following points:

  • Do not rename or directly edit the SQL files under the %commerce_server_root%\Sdk\Samples\SiteCreate folder. If you need to edit these files, create a copy to modify, and copy the modified file back to the original location. Renaming these files can cause errors and failures during migration.

  • If you have made changes to the transaction tables that are incompatible with the DBStorage system, the Upgrade Wizard will not migrate the data. If the order data is incompatible, you must create a custom migration tool. This section lists the changes that the Upgrade Wizard makes to complete the migration. This information can help you design your own migration tool.

  • Date-time data from Commerce Server 2002 is stored by using the local time zone. During migration, this data is changed to Coordinated Universal Time (UTC). Because the time zone of the existing data cannot be determined, the Upgrade Wizard migrates the date-time data to the UTC time zone and assumes that the data was stored by using the local time zone of the computer that is running the Upgrade Wizard.

  • If a failure occurs during the order migration, the ID of the record involved is logged to the error log you specified on the Orders Configuration Settings page of the Upgrade Wizard. The migration continues as long as possible and stops only if the error log surpasses 10,000 errors.

  • To migrate orders that were logged and skipped, fix the error listed in the log file and rerun the Upgrade Wizard. When you run the Upgrade Wizard for the second time, on the Orders Configuration Settings page, select Import orders/baskets from the exception log.

  • The following code example shows the XML schema of the Orders exception log.

    <?xml version="1.0" encoding="UTF-8"?>
    <!--
      ExceptionLogConfig.xsd
      Copyright (C) 2004 Microsoft Corporation
    -->
    
    <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
      <xs:element name="ExceptionLog">
        <xs:complexType>
          <xs:sequence>
            <xs:element name="BasketGroup" 
              type="PABasketGroup" maxOccurs="1" />
            <xs:element name="OrderGroup" type="PAOrderGroup" 
              maxOccurs="1" />
          </xs:sequence>
        </xs:complexType>
      </xs:element>
      <xs:complexType name="PABasketGroup">
        <xs:sequence>
          <xs:element name="Record" type="PARecord" 
            maxOccurs="unbounded" />
        </xs:sequence>
      </xs:complexType>
      <xs:complexType name="PAOrderGroup">
        <xs:sequence>
          <xs:element name="Record" type="PARecord" 
            maxOccurs="unbounded" />
        </xs:sequence>
      </xs:complexType>
      <xs:complexType name="PARecord">
        <xs:attribute name="ordergroup_id" type="xs:string" 
          use="required"/>
      </xs:complexType>
    </xs:schema>
    

See Also

Other Resources

Data Migration to Commerce Server 2007

Migration Changes for Extended Orders Systems