ALTER TABLE blc_payment_transaction ADD gateway_message VARCHAR(500) NULL;
ALTER TABLE blc_payment_transaction ADD gateway_transaction_id VARCHAR(255) NULL;
CREATE TABLE blc_saved_payment_method (id VARCHAR(36) NOT NULL, attributes LONGTEXT NULL, billing_address LONGTEXT NULL, is_default_for_owner CHAR(1) DEFAULT 'N' NULL, display_attributes LONGTEXT NULL, gateway_type VARCHAR(60) NULL, last_tx_date_time datetime DEFAULT NULL NULL, last_tx_result_code VARCHAR(255) NULL, name VARCHAR(255) NULL, originating_payment_id VARCHAR(36) NULL, owning_user_id VARCHAR(36) NULL, owning_user_type VARCHAR(60) NULL, payment_method_properties LONGTEXT NULL, trk_archived CHAR(1) DEFAULT 'N' NOT NULL, audit_creation_time datetime DEFAULT NULL NULL, audit_creator VARCHAR(60) NULL, audit_update_time datetime DEFAULT NULL NULL, audit_updater VARCHAR(60) NULL, trk_change_details LONGTEXT NULL, trk_tenant_id VARCHAR(36) NULL, type VARCHAR(60) NULL, version INT NOT NULL, CONSTRAINT PK_BLC_SAVED_PAYMENT_METHOD PRIMARY KEY (id));
ALTER TABLE blc_payment ADD owning_user_id VARCHAR(36) NULL;
ALTER TABLE blc_payment ADD owning_user_type VARCHAR(60) NULL;
UPDATE blc_payment SET owning_user_type = CASE WHEN is_customer_registered = 'Y' THEN 'BLC_CUSTOMER' WHEN is_customer_registered = 'N' THEN 'ANONYMOUS' END, owning_user_id = CASE WHEN is_customer_registered = 'Y' THEN customer_id WHEN is_customer_registered = 'N' THEN NULL END;
ALTER TABLE blc_payment ADD should_save_pmt_for_future_use CHAR(1) DEFAULT 'N' NOT NULL;
UPDATE blc_payment SET should_save_pmt_for_future_use = should_save_pmt_to_customer;
ALTER TABLE blc_payment_transaction ADD management_state_reason VARCHAR(60) NULL;
ALTER TABLE blc_payment_transaction ADD previous_request_ids LONGTEXT NULL;
