Extending the data migration script

Changes to tables in previous versions of WebSphere Commerce requires you to alter the data migration script prior to migrating your database.

If the previous version WebSphere Commerce database schema has been extended, the data migration script must be updated. For example, a new column called FRIEND was added to the USERREG table as INTEGER DEFAULT 0, and FRIEND has a foreign key to the MBRGRP table. To extend the data migration script:

  1. Navigate to:

    • WC_installdir/schema/migration/xx/database_type

    • Windows: WC_installdir\schema\migration\xx\database_type

      Where:

    • xx is either 55, 56, or 561.

    • database_type is:

      • db2\os400 for DB2 on i5/OS databases

      • db2 for DB2 databases

      • oracle for Oracle databases

  2. Locate the wcs.schema.delta.sql script file.

  3. Modify the script file by adding the following SQL statement at the end of the file:

    • alter table userreg add column friend integer default 0;

    • alter table userreg add friend integer default 0 null;

  4. Save the updated wcs.schema.delta.sql file.

  5. Navigate to:

  6. Make a copy of the file wcs.referential.sql, in the same directory and rename it to wcs.referential_instance.sql.

  7. Modify the wcs.referential_instance.sql file to add a referential constraint
    ALTER TABLE USERREG ADD CONSTRAINT F_FRIEND FOREIGN KEY (FRIEND) 
      REFERENCES MBRGRP ON DELETE CASCADE;
    
    
    

  8. Save the file.


 

Related Concepts


Migrate from a previous version of WebSphere Commerce

 

Related tasks


Migrate the WebSphere Commerce database
Migrate the development environment database
Migrate the WebSphere Commerce database using the migration script

 

Related Reference


Data migration plan file