feat: lead dashboard with status history (conversion = WON) #29
No files matched your search
@@ -1,5 +1,5 @@
|
||||
-- Co-Lite change add-lead-dashboard: event lead status history (design decision 1).
|
||||
-- Target: `service-counter`. Additive only. Run once, after the release package, before 02.
|
||||
-- Target: `service-counter`. Additive only. Run before the new images go live (services-counter writes this table), then 02.
|
||||
USE `service-counter`;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `event_lead_status_change` (
|
||||
|
||||
@@ -12,4 +12,4 @@ INSERT INTO `event_lead_status_change` (`company_id`, `event_lead_id`, `from_sta
|
||||
SELECT el.company_id, el.id, 'OPEN', el.status, COALESCE(el.updated_at, el.captured_at), COALESCE(el.updated_by, el.captured_by)
|
||||
FROM `event_lead` el
|
||||
WHERE el.status <> 'OPEN'
|
||||
AND NOT EXISTS (SELECT 1 FROM `event_lead_status_change` s WHERE s.event_lead_id = el.id AND s.from_status IS NOT NULL);
|
||||
AND NOT EXISTS (SELECT 1 FROM `event_lead_status_change` s WHERE s.event_lead_id = el.id AND s.to_status = el.status);
|
||||
Reference in new issue
Block a user