dim_discount_campaign_rate_bundle_scope


Description

Unified dimension defining which rate bundles (and optionally which specific terms) are in scope for each discount campaign, across all three restriction types (RATE_BUNDLE, FLAT_FEE, MODULE). One row per restriction entry. The restriction_type column disambiguates which price component is scoped.

A NULL rate_bundle_id means the campaign applies to all rate bundles of that type. A NULL rate_bundle_term_id means the campaign applies to all terms of the rate bundle (only valid when rate_bundle_id is also set).

Use this table to answer: “Which rate bundles have a discount campaign set on them?” and “Does this campaign apply to all bundles or specific ones?”

Join with dim_discount_campaign_discount_period on restriction_id + restriction_type to get the actual discount amounts for each scoped restriction.

Columns

Column Type Size Nulls Auto Default Children Parents Comments
discount_campaign_rate_bundle_scope_id varchar 256 null

Surrogate primary key derived from restriction_type and restriction_id.

restriction_type varchar 256 null

The type of price component this scope entry targets.

One of: * RATE_BUNDLE: Scope over the main contract rate bundle price. * FLAT_FEE: Scope over a flat-fee rate bundle price. * MODULE: Scope over an optional add-on module price.

restriction_id int8 19 null

The id from the source restriction table. Unique within each restriction_type.

discount_campaign_id int8 19 null
dim_discount_campaign.discount_campaign_id Implied Constraint R

The discount campaign this rate bundle scope entry belongs to.

rate_bundle_id int8 19 null
dim_rate_bundle.rate_bundle_id Implied Constraint R

The rate bundle in scope for this campaign restriction. NULL means the campaign applies to all rate bundles of that restriction type.

rate_bundle_term_id int8 19 null
dim_rate_bundle_term.rate_bundle_term_id Implied Constraint R

The specific rate bundle term in scope. NULL means the campaign applies to all terms of the rate bundle. Always NULL when rate_bundle_id is NULL.

applies_to_all_rate_bundles bool 1 null

True when rate_bundle_id is NULL, meaning this campaign restriction covers all rate bundles of the given restriction type without exception.

applies_to_all_terms bool 1 null

True when rate_bundle_term_id is NULL, meaning this campaign restriction covers all terms of the scoped rate bundle.

last_updated timestamptz 35 null

System column. UTC Timestamp at which entry was calculated (lags shortly behind source system).

Relationships