subscription: Add missing clause to be able to use the composite index {tenant_record_id, account_record_id}
@@ -108,7 +108,8 @@ join (select
where
se1.user_type in ('CREATE','TRANSFER') and se1.is_active
and (se2.id IS NULL or se2.effective_date \> :cutoffDt)
- and <accountRecordIdField("se1.")> = :accountRecordId) tmp on tmp.subscription_id = se.subscription_id
+ and <accountRecordIdField("se1.")> = :accountRecordId
+ <AND_CHECK_TENANT("se1.")>) tmp on tmp.subscription_id = se.subscription_id
where
se.is_active
and <accountRecordIdField("se.")> = :accountRecordId
