-- liquibase formatted sql
UPDATE tenant.blc_tenant_catalog tcat_update
SET vendor_ref = subquery.vendor_ref,
updated_timestamp = ((now()) AT TIME ZONE ('UTC'))
FROM (SELECT tappcat.implicit, tcat_parent.vendor_ref
FROM tenant.blc_tenant_catalog tcat_parent
INNER JOIN tenant.blc_tenant_application_catalog tappcat
ON tcat_parent.id = tappcat.context_id
-- We only care about main catalogs whose vendor ref is not null
WHERE tcat_parent.vendor_ref IS NOT NULL) AS subquery
WHERE tcat_update.id = subquery.implicit;
-- Trigger a re-sync of catalog tables across all schemas
DELETE
from tenant.blc_notification_state
where ENTITY_TYPE = 'com.broadleafcommerce.tenant.provider.jpa.domain.JpaTenantCatalog'
AND notification_name = 'PERSISTENCE';
INSERT INTO tenant.blc_notification_state (ID, CONTAINER, ENTITY_TYPE, CHANGE_TIMESTAMP, CHANGE_TIMESTAMP_ACK, ACKED,
STOPPED,
ATTEMPTS, NEXT_ATTEMPT, NOTIFICATION_NAME, MESSAGE_TYPE, MESSAGE_VALUE)
SELECT concat('blc_', id::VARCHAR),
id,
'com.broadleafcommerce.tenant.provider.jpa.domain.JpaTenantCatalog',
((now() - INTERVAL '1 HOUR') AT TIME ZONE ('UTC')),
NULL,
'N',
'N',
0,
NULL,
'PERSISTENCE',
NULL,
NULL
FROM tenant.blc_tenant_catalog;