Migration from 2.1.0-GA to 2.2.0-GA
Schema Migration
The best way to handle schema migrations is to follow this guide on DB Migrations with Liquibase.
Offer Code rules removed
Previously, offer codes used rules to determine if a customer was eligible for a specific offer code by evaluating the customer's email address. Offer code now has an explicit email address field and OfferCodeOfferCodeRuleXref
has been deprecated.
Since Offer Code now has an email address field, the database table will need to be updated:
ALTER TABLE BLC_OFFER_CODE ADD EMAIL_ADDRESS VARCHAR(255);
If there were any email rules for offer codes then that information will need to be migrated to this new structure. This query will return the list of all offer codes that have offer rules along with the match rule:
SELECT BLC_OFFER_CODE.OFFER_CODE_ID, BLC_OFFER_CODE.OFFER_CODE, BLC_OFFER_CODE_RULE.MATCH_RULE FROM BLC_OFFER_CODE
JOIN BLC_OFFER_CODE_RULE_MAP ON BLC_OFFER_CODE.OFFER_CODE_ID = BLC_OFFER_CODE_RULE_MAP.BLC_OFFER_CODE_OFFER_CODE_ID
JOIN BLC_OFFER_CODE_RULE ON BLC_OFFER_CODE_RULE_MAP.OFFER_CODE_RULE_ID = BLC_OFFER_CODE_RULE.OFFER_CODE_RULE_ID;
The list of match rules will resemble something similar to customer.?emailAddress=="test@test.com"
. In order to migrate to the new structure the email address will need to be extracted from the match rule expression and used to set the BLC_OFFER_CODE.EMAIL_ADDRESS
field.
The new email field on offer code does not evaluate regular expressions, only exact email address matches will correctly validate. Therefore, if the email address contained within the match rule is a regular expression (i.e. *@vt.edu
), then a new BLC_OFFER_CODE_GEN_INFO
record will need to be created with the EMAIL_REGEX
field set equal to the email regular expression. Also, the BLC_OFFER_CODE
record or records will need to be associated with the new offer generation info record by setting the CODE_GEN_ID
field to the id of the new BLC_OFFER_CODE_GEN_INFO
record. Finally, if a offer code is associated with an offer code generation record and you want only the email regular expression to be evaluated, then the email field on the offer code record should be left empty.
After all offer code data has been properly migrated and tested, then all BLC_OFFER_CODE_RULE
and BLC_OFFER_CODE_RULE_MAP
records should be deleted to ensure that no offer rules are executed.