dim_discount_campaign_scope


Description

Defines which rate bundles (and optionally which specific terms) are in scope for each discount campaign, across all three price component types: RATE_BUNDLE (main contract), FLAT_FEE (flat-fee bundle), and MODULE (optional add-on). One row per scope entry.

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 meaningful 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 only specific ones?”

Join with dim_discount_campaign_discount_period on discount_campaign_scope_id to get the actual discount amounts for each scoped entry.

Columns

Column Type Size Nulls Auto Default Children Parents Comments
discount_campaign_scope_id varchar 256 null
dim_discount_campaign_discount_period.discount_campaign_scope_id dim_discount_campaign_discount_period_discount_campaign_scope_id_fkey R

Surrogate primary key uniquely identifying a campaign scope entry.

scope_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.

discount_campaign_id int8 19 null

The discount campaign this 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. NULL means the campaign applies to all rate bundles of the given 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 this campaign covers all rate bundles of the given type rather than a specific one.

applies_to_all_terms bool 1 null

True when this campaign covers all terms of the scoped rate bundle rather than a specific term.

last_updated timestamptz 35 null

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

Relationships