Migration from 1.1.2-GA to 1.2.0-GA
PriceList Data changes
Please run the following script to update any existing PriceList data that you may have.
UPDATE BLC_PRICE_LIST SET CUST_QUALIFICATION_TYPE = CUSTOMER_SEGMENTS_AND_ASSIGNMENT_TO_CUSTOMERS WHERE CUST_QUALIFICATION_TYPE = 'CUSTOMER_SEGMENTS_AND_SPECIFIC_CUSTOMERS';
Sandbox capability removed
Previously segments were sandboxable and included all of the necessary sandbox columns. This is no longer the case and all segment modifications are only in production.
If you have existing records that were in a sandbox from pending changes that are not in production, these will now be included in queries and you should remove them. This delete query should clear up existing sandbox records in these tables:
DELETE FROM BLC_CUSTOMER_SEGMENT WHERE SNDBX_ID IS NOT NULL;
DELETE FROM BLC_CUSTOMER_SEGMENT_XREF WHERE SNDBX_ID IS NOT NULL;
Optionally, you can remove all of the columns starting with SNDBX_
in the BLC_CUSTOMER_SEGMENT
and BLC_CUSTOMER_CUSTOMER_SEG_XREF
. If you do not remove them then all of the columns become benign.
Hard relationship to a customer is removed
There was a foreign key reference to the BLC_CUSTOMER
table from the BLC_CUSTOMER_SEGMENT_XREF
table. This is now a soft reference and supports other identifiers like EMAIL
and LOGIN
(see CustomerSegmentIdentifierType for all available types).
To migrate existing data, first create a column in the BLC_CUSTOMER_SEGMENT
table:
ALTER TABLE BLC_CUSTOMER_SEGMENT ADD IDENTIFIER_TYPE VARCHAR(255);
Then add a column in the BLC_CUSTOMER_SEGMENT_XREF
table to hold the soft reference:
ALTER TABLE BLC_CUSTOMER_SEGMENT_XREF ADD EXTERNAL_IDENTIFIER VARCHAR(255);
Then, migrate existing data from the BLC_CUSTOMER_SEGMENT_XREF
table to use the new column (only necessary for CUSTOMER_SET
segments);
UPDATE BLC_CUSTOMER_SEGMENT_XREF SET EXTERNAL_IDENTIFIER = CUSTOMER_ID WHERE CUSTOMER_SEGMENT_ID IN (SELECT seg.CUSTOMER_SEGMENT_ID FROM BLC_CUSTOMER_SEGMENT seg WHERE CUSTOMER_SEGMENT_TYPE = 'CUSTOMER_SET');
Once the data migration has been completed you can then optionally clean up the previous columns in those tables:
ALTER TABLE BLC_CUSTOMER_SEGMENT_XREF DROP COLUMN CUSTOMER_ID;
These migration scripts are specifically for MySQL but other databases should ve very similar
Customer segments can be matched via a customer identifier
A new field on CustomerSegment named identifierType was added to determine if the new field on CustomerCustomerSegmentXref, named externalIdentifier, is suppose to be an Email, Login, or Id. These two fields were added in order to replace the need for a hard reference to a Customer therefore the join on Customer on CustomerCustomerSegmentXref was removed. In order to create more types then a new CustomerSegmentIdentifierType needs to be made. Additionally a custom CustomerSegmentDaoExtensionHandler also needs to be made so that the queries made against CustomerSegments can be modified.
> For example if a new CustomerSegmentIdentifierType called FIRST_NAME is added then a CustomerSegmentDaoExtensionHandler needs to be made like this
@Component
public class DemoCustomerSegmentDaoExtenssionHandler extends AbstractCustomerSegmentDaoExtensionHandler {
@Resource(name = "blCustomerSegmentDaoExtensionManager")
protected CustomerSegmentDaoExtensionManager extensionManager;
@PostConstruct
public void init() {
if (isEnabled()) {
extensionManager.registerHandler(this);
}
}
@Override
public ExtensionResultStatusType addRestrictions(Customer customer, Map<String, Object> restrictions) {
restrictions.put("FIRST_NAME", customer.getFirstName());
return ExtensionResultStatusType.HANDLED_CONTINUE;
}
}