From 6a5a2923a2270ecb211bec5a90610694221efd51 Mon Sep 17 00:00:00 2001 From: Sean Rose Date: Mon, 29 Sep 2025 14:58:39 -0700 Subject: [PATCH] fix(SubPlat): Only generate "Mozilla Account Change" and "Plan Change" events for active subscriptions (DENG-9770). --- .../logical_subscription_events_v1_live/view.sql | 2 ++ .../service_subscription_events_v1_live/view.sql | 2 ++ 2 files changed, 4 insertions(+) diff --git a/sql/moz-fx-data-shared-prod/subscription_platform_derived/logical_subscription_events_v1_live/view.sql b/sql/moz-fx-data-shared-prod/subscription_platform_derived/logical_subscription_events_v1_live/view.sql index fc19d4b9adf..0692c1bbcc5 100644 --- a/sql/moz-fx-data-shared-prod/subscription_platform_derived/logical_subscription_events_v1_live/view.sql +++ b/sql/moz-fx-data-shared-prod/subscription_platform_derived/logical_subscription_events_v1_live/view.sql @@ -60,6 +60,7 @@ mozilla_account_change_events AS ( WHERE old_subscription IS NOT NULL AND subscription.mozilla_account_id_sha256 IS DISTINCT FROM old_subscription.mozilla_account_id_sha256 + AND subscription.ended_at IS NULL ), plan_change_events AS ( SELECT @@ -91,6 +92,7 @@ plan_change_events AS ( subscription_changes WHERE subscription.provider_plan_id != old_subscription.provider_plan_id + AND subscription.ended_at IS NULL ), trial_change_events AS ( SELECT diff --git a/sql/moz-fx-data-shared-prod/subscription_platform_derived/service_subscription_events_v1_live/view.sql b/sql/moz-fx-data-shared-prod/subscription_platform_derived/service_subscription_events_v1_live/view.sql index 0ff7164f937..649c16fe2e2 100644 --- a/sql/moz-fx-data-shared-prod/subscription_platform_derived/service_subscription_events_v1_live/view.sql +++ b/sql/moz-fx-data-shared-prod/subscription_platform_derived/service_subscription_events_v1_live/view.sql @@ -64,6 +64,7 @@ mozilla_account_change_events AS ( WHERE old_subscription IS NOT NULL AND subscription.mozilla_account_id_sha256 IS DISTINCT FROM old_subscription.mozilla_account_id_sha256 + AND subscription.ended_at IS NULL ), plan_change_events AS ( SELECT @@ -105,6 +106,7 @@ plan_change_events AS ( subscription_changes WHERE subscription.provider_plan_id != old_subscription.provider_plan_id + AND subscription.ended_at IS NULL ), trial_change_events AS ( SELECT