Schema

Learn how Stigg entities are mapped to tables when Stigg is integrated with a data warehouse

Available data types

The following diagram describes the relations between the available data types:

Notes

  • Mandatory fields are represented using a NOT NULL column constraint.
  • DateTime field type is a string representing a date and time in ISO timestamp format.
  • JSON field type represents JSON object literals containing key/value pairs.

Customer

Represents a customer of your application, which can be either an individual or an organization. Each customer can have a subscription to a product, a set of entitlements, and usage records.

Table: CUSTOMERS

ColumnTypeMandatoryDescription
CUSTOMER_IDVARCHARYesCustomer identifier
EMAILVARCHAREmail address
NAMEVARCHARCustomer name
BILLING_CURRENCYVARCHARPreferred billing currency e.g USD
BILLING_IDVARCHARIdentifier of the customer in the billing solution that’s integrated with Stigg, i.e. Stripe ID
BILLING_LINK_URLVARCHARURL for the customer entity in the billing solution that’s integrated with Stigg
DEFAULT_PAYMENT_EXPIRATION_MONTHNUMBERExpiration month of the customer’s default payment method
DEFAULT_PAYMENT_EXPIRATION_YEARNUMBERExpiration year of the customer’s default payment method
DEFAULT_PAYMENT_METHOD_IDVARCHARID of the customer’s default payment method in the billing solution (Stripe ID)
DEFAULT_PAYMENT_METHOD_LAST4_DIGITSVARCHARLast 4 digits of customer’s default payment method
DEFAULT_PAYMENT_METHOD_TYPEVARCHAREnum. Type of default payment method. One of: CARD, BANK
DELETED_ATTIMESTAMP_TZDate and time of when the customer was archived
ENVIRONMENT_IDVARCHARYesEnvironment identifier
HAS_ACTIVE_SUBSCRIPTIONBOOLEANYesHas an active subscription
IDVARCHARYesCustomer internal identifier in Stigg
UPDATED_ATTIMESTAMP_TZYesLast update date and time
CREATED_ATTIMESTAMP_TZYesCreation date and time
ADDITIONAL_META_DATAVARCHARAdditional metadata JSON in a text format
COUPON_IDVARCHARCoupon ID of an applied coupon

Customer Resource

Represents a resource associated with a customer, such as a site or an app. Each resource can have its own subscription to a product, as well as a distinct set of entitlements and usage records.

Table: CUSTOMER_RESOURCES

ColumnTypeMandatoryDescription
ENVIRONMENT_IDVARCHARYesEnvironment identifier
RESOURCE_IDVARCHARYesResource identifier
CUSTOMER_IDVARCHARYesCustomer identifier
CREATED_ATTIMESTAMP_TZYesCreation date and time
UPDATED_ATTIMESTAMP_TZYesLast update date and time

Subscription

Represents the combination of functionalities to which a specific customer has access, including their limitations, the duration of access, and the associated cost. Subscriptions encompass both plans and add-ons.

Table: SUBSCRIPTIONS

ColumnTypeMandatoryDescription
SUBSCRIPTION_IDVARCHARYesSubscription Identifier
ENVIRONMENT_IDVARCHARYesEnvironment identifier
IDVARCHARYesSubscription internal identifier
CREATED_ATTIMESTAMP_TZYesCreation date and time
UPDATED_ATTIMESTAMP_TZYesLast update date and time
START_DATETIMESTAMP_TZYesSubscription start date
END_DATETIMESTAMP_TZSubscription end date
CANCELLATION_DATETIMESTAMP_TZDate of subscription cancellation
TRIAL_END_DATETIMESTAMP_TZEnd date of trial period
BILLING_IDVARCHARBilling identifier (Stripe ID) of the subscription
OLD_BILLING_IDVARCHARPrevious billing identifier (Stripe ID), is set only for canceled or expired subscriptions.
BILLING_LINK_URLVARCHARURL for the subscription entity in the billing solution (Stripe ID)
STATUSVARCHARYesEnum. Subscription status. Can be one of: PAYMENT_PENDING, ACTIVE, EXPIRED, IN_TRIAL, CANCELED, NOT_STARTED.
RESOURCE_IDVARCHARResource identifier
IS_CUSTOM_PRICE_SUBSCRIPTIONBOOLEANIndicates if subscription has custom pricing (i.e. not self-served)
CURRENT_BILLING_PERIOD_STARTTIMESTAMP_TZStart of the current billing period
CURRENT_BILLING_PERIOD_ENDTIMESTAMP_TZEnd of the current billing period
PRICING_TYPEVARCHARYesEnum. Type of pricing applied. Can be one of: FREE, PAID,CUSTOM.
ADDITIONAL_META_DATAVARCHARAdditional metadata
PAYMENT_COLLECTIONVARCHARYesEnum. Payment collection status. Can be one of: NOT_REQUIRED, PROCESSING, FAILED, ACTION_REQUIRED (= 3DS).
CUSTOMER_IDVARCHARYesAssociated customer identifier
PLAN_IDVARCHARYesSubscription plan identifier
COUPON_IDVARCHARThis field is deprecated, use the SUBSCRIPTION_APPLIED_COUPONS relation table instead

Subscription Price

Represents the price of the subscription. Multiple prices can be associated with a single subscription to support a pricing model based on multiple billable metrics

Table: SUBSCRIPTION_PRICES

ColumnTypeMandatoryDescription
IDVARCHARYesPrice internal identifier
CREATED_ATTIMESTAMP_TZYesCreation date and time
UPDATED_ATTIMESTAMP_TZYesLast update date and time
USAGE_LIMITNUMBERUsage limit associated with the price
FEATURE_IDVARCHARIdentifier for the associated feature, if this price represents a billable metric
BILLING_MODELVARCHAREnum. Billing model used. Can be one of: FLAT_FEE, PER_UNIT, USAGE_BASED.
SUBSCRIPTION_IDVARCHARYesAssociated subscription identifier
PRICE_IDVARCHARAssociated plan or add-on price identifier
ENVIRONMENT_IDVARCHARYesEnvironment identifier

Subscription Add-on

Represents the quantity of an add-on that is included in the subscription.

Table: SUBSCRIPTION_ADDONS

ColumnTypeMandatoryDescription
IDVARCHARYesSubscriptionAddon internal identifier
QUANTITYNUMBERYesQuantity of the add-on
CREATED_ATTIMESTAMP_TZYesCreation date and time
UPDATED_ATTIMESTAMP_TZYesLast update date and time
SUBSCRIPTION_IDVARCHARYesAssociated subscription identifier
ADDON_IDVARCHARYesAssociated add-on identifier
PRICE_IDVARCHARAssociated plan or add-on price identifier
ENVIRONMENT_IDVARCHARYesEnvironment identifier

Subscription Applied Coupons

Represents a coupon entity attached to a subscription.

Table: SUBSCRIPTION_APPLIED_COUPONS

ColumnTypeMandatoryDescription
IDVARCHARYesInternal identifier
ENVIRONMENT_IDVARCHARYesEnvironment identifier
CREATED_ATTIMESTAMP_TZYesCreation date and time
UPDATED_ATTIMESTAMP_TZYesLast update date and time
DELETED_ATVARCHARDate and time the coupon was removed from the subscription
SUBSCRIPTION_IDVARCHARYesAssociated subscription identifier
COUPON_IDVARCHARYesAssociated coupon identifier
STATUSVARCHARYesEnum - SubscriptionCouponStatus. Can be one of: ACTIVE, EXPIRED or REMOVED

Product

Represents a product or product line. Typically, products group together plans and add-ons.

Table: PRODUCTS

ColumnTypeMandatoryDescription
IDVARCHARYesProduct internal identifier
DISPLAY_NAMEVARCHARDisplay name of the product
PRODUCT_IDVARCHARYesProduct identifier
DESCRIPTIONVARCHARDescription of the product
CREATED_ATTIMESTAMP_TZYesCreation date and time of the product
UPDATED_ATTIMESTAMP_TZYesLast update date and time
ENVIRONMENT_IDVARCHARYesIdentifier for the associated environment
MULTIPLE_SUBSCRIPTIONSBOOLEANYesSupports multiple subscriptions, each resource can have a separate subscription
ADDITIONAL_META_DATAVARCHARAdditional metadata for the product

Plan

Represents a package of a product for which customers are charged during a subscription period. The features included in each plan are defined by entitlements associated with the plan. Plans can inherit features from one another.

Table: PLANS

ColumnTypeMandatoryDescription
IDVARCHARYesPlan internal identifier
CREATED_ATTIMESTAMP_TZYesCreation date and time of the plan
UPDATED_ATTIMESTAMP_TZYesLast update date and time of the plan
PLAN_IDVARCHARYesPlan identifier
BILLING_IDVARCHARBilling identifier (Stripe ID)
BILLING_LINK_URLVARCHARURL for billing information
DISPLAY_NAMEVARCHARYesDisplay name of the plan
PRICING_TYPEVARCHAREnum. Type of pricing used for the plan. Can be one of: FREE, PAID, CUSTOM.
DESCRIPTIONVARCHARDescription of the plan
ENVIRONMENT_IDVARCHARYesIdentifier for the associated environment
IS_LATESTBOOLEANIndicates if this is the latest version of the plan
VERSION_NUMBERNUMBERVersion number of the plan
ADDITIONAL_META_DATAVARCHARAdditional metadata for the plan
PRODUCT_IDVARCHARYesAssociated product identifier
BASE_PLAN_IDVARCHARParent plan identifier if this is a child plan

Add-on

Represents a package that extends specific plans. Add-ons are dependent on the lifecycle of the plan they extend; meaning, when a subscription expires, customers also lose access to the plan’s add-ons. The features included in each add-on are defined by entitlements associated with the add-on.

Table: ADDONS

ColumnTypeMandatoryDescription
IDVARCHARYesAdd-on internal identifier
CREATED_ATTIMESTAMP_TZYesCreation date and time
UPDATED_ATTIMESTAMP_TZYesLast update date and time
ADDON_IDVARCHARYesAdd-on identifier
BILLING_IDVARCHARBilling identifier (Stripe ID)
BILLING_LINK_URLVARCHARURL for billing information of the add-on
DISPLAY_NAMEVARCHARYesDisplay name of the add-on
PRICING_TYPEVARCHAREnum. Pricing type used for the add-on. Can be one of: FREE, PAID, CUSTOM. For add-ons, the value is always PAID.
DESCRIPTIONVARCHARDescription of the add-on
ENVIRONMENT_IDVARCHARIdentifier for the associated environment
PRODUCT_IDVARCHARIdentifier for the associated product
IS_LATESTBOOLEANIndicates if this is the latest version of the add-on
VERSION_NUMBERNUMBERYesVersion number of the add-on
ADDITIONAL_META_DATAVARCHARAdditional metadata for the add-on

Price

Represents the price of a package and its settings.

Table: PRICES

ColumnTypeMandatoryDescription
IDVARCHARYesPrice internal identifier
CREATED_ATTIMESTAMP_TZYesCreation date and time of the price
UPDATED_ATTIMESTAMP_TZYesLast update date and time
BILLING_PERIODVARCHARYesEnum. Billing period associated with the price. Can be one of: MONTHLY, ANNUALLY.
BILLING_MODELVARCHARYesEnum. Billing model used for this price. Can be one of: FLAT_FEE, PER_UNIT, USAGE_BASED.
BILLING_IDVARCHARBilling identifier associated with the price
PRICE_AMOUNTNUMBERMonetary value of the price
PRICE_CURRENCYVARCHARCurrency of the price
BILLING_COUNTRY_CODEVARCHARCountry code for billing
FEATURE_IDVARCHARIdentifier for the associated feature
MIN_UNIT_QUANTITYNUMBERMinimum unit quantity for applying this price
PACKAGE_IDVARCHARIdentifier for the associated package, can belong to a plan or an add-on
MAX_UNIT_QUANTITYNUMBERMaximum unit quantity for applying this price
ENVIRONMENT_IDVARCHARYesEnvironment identifier
TIERS_MODEVARCHAREnum. Mode of tiers for the price, if pricing is tiered. Can be one of: VOLUME, VOLUME_PER_UNIT, GRADUATED.
TIERSVARCHARTiers associated with the price. List of JSON objects with the following structure: { upTo: Float!; unitPriceAmount: Float!; unitPriceCurrency: String!; }

Package Entitlement

Represents a feature entitlement associated with a plan or add-on.

Table: PACKAGE_ENTITLEMENTS

ColumnTypeMandatoryDescription
IDVARCHARYesUnique identifier for the package entitlement
DESCRIPTIONVARCHARDescription of the package entitlement
FEATURE_IDVARCHARYesIdentifier for the associated feature
PACKAGE_IDVARCHARYesIdentifier for the associated package
CREATED_ATTIMESTAMP_TZCreation date and time of the package entitlement
UPDATED_ATTIMESTAMP_TZLast update date and time of the package entitlement
USAGE_LIMITNUMBERUsage limit for the entitlement
HAS_UNLIMITED_USAGEBOOLEANIndicates if the entitlement has unlimited usage
IS_CUSTOMBOOLEANIndicates if the entitlement is custom
ENVIRONMENT_IDVARCHARYesIdentifier for the associated environment
RESET_PERIODVARCHAREnum. Reset period for the entitlement. Can be one of: MONTH, WEEK, DAY, HOUR.

Promotional Entitlement

Represents ad-hoc entitlements that are given to a specific customer. Promotional entitlements can be granted to customers for a limited time period or throughout their entire lifetime.

Table: PROMOTIONAL_ENTITLEMENTS

ColumnTypeMandatoryDescription
IDVARCHARYesUnique identifier for the promotional entitlement
DESCRIPTIONVARCHARDescription of the promotional entitlement
CUSTOMER_IDVARCHARYesAssociated customer identifier
FEATURE_IDVARCHARYesIdentifier for the associated feature
CREATED_ATTIMESTAMP_TZYesCreation date and time of the entitlement
UPDATED_ATTIMESTAMP_TZYesLast update date and time of the entitlement
START_DATETIMESTAMP_TZYesStart date of the promotional entitlement
END_DATETIMESTAMP_TZEnd date of the promotional entitlement
USAGE_LIMITNUMBERUsage limit for the entitlement
HAS_UNLIMITED_USAGEBOOLEANIndicates if the entitlement has unlimited usage
STATUSVARCHARYesEnum. Status of the promotional entitlement. Can be one of: Active, Expired, Paused.
PERIODVARCHARYesEnum. Period of the promotional entitlement. Can be one of: ONE_WEEK, ONE_MONTH, SIX_MONTH, ONE_YEAR, LIFETIME, CUSTOM.
RESET_PERIODVARCHAREnum. Reset period for the entitlement. Can be one of: MONTH, WEEK, DAY, HOUR.
ENVIRONMENT_IDVARCHARIdentifier for the associated environment

Feature

Represents a configurable functionality in the product that can be monetized.

Table: FEATURES

ColumnTypeMandatoryDescription
IDVARCHARYesFeature internal identifier
DISPLAY_NAMEVARCHARYesDisplay name of the feature
FEATURE_IDVARCHARYesFeature identifier
CREATED_ATTIMESTAMP_TZYesCreation date and time of the feature
UPDATED_ATTIMESTAMP_TZYesLast update date and time of the feature
FEATURE_UNITSVARCHARUnits in which the feature is measured
FEATURE_UNITS_PLURALVARCHARPlural form of the feature units
DESCRIPTIONVARCHARDescription of the feature
FEATURE_TYPEVARCHARYesEnum. Type of the feature. Can be one of: BOOLEAN, NUMBER.
METER_TYPEVARCHAREnum. Meter type of the feature. Can be one of: None, Fluctuating, Incremental.
ENVIRONMENT_IDVARCHARYesIdentifier for the associated environment
ADDITIONAL_META_DATAVARCHARAdditional metadata for the feature

Entitlement

Represents the right to use an application feature, and to what extent. In Stigg, customer entitlements can be granted from multiple sources: plans, add-ons, overlapping trial subscriptions, promotional entitlements, and additional products.

Entitlements are typically computed and cached. If one of the entitlement sources changes, the entitlements need to be refreshed. You can read about how entitlements are calculated here.

Table: ENTITLEMENTS

ColumnTypeMandatoryDescription
IDVARCHARYesEntitlement internal identifier
CREATED_ATTIMESTAMP_TZYesCreation date and time of the entitlement
UPDATED_ATTIMESTAMP_TZYesLast update date and time of the entitlement
ENVIRONMENT_IDVARCHARYesIdentifier for the associated environment
CUSTOMER_UUIDVARCHARYesCustomer internal identifier
CUSTOMER_IDVARCHARYesCustomer identifier
RESOURCE_UUIDVARCHARResource internal identifier
RESOURCE_IDVARCHARResource identifier
FEATURE_UUIDVARCHARYesFeature internal identifier
FEATURE_IDVARCHARYesFeature identifier
IS_DELETEDBOOLEANYesIndicates whether the entitlement was deleted and is no longer applicable
CURRENT_USAGENUMBERCurrent usage of the entitlement
USAGE_LIMITNUMBERUsage limit for the entitlement
HAS_UNLIMITED_USAGEBOOLEANIndicates if the entitlement has unlimited usage
USAGE_PERIOD_ANCHORTIMESTAMP_TZThe anchor for calculating the usage period for metered entitlements with a reset period configured
USAGE_PERIOD_STARTTIMESTAMP_TZThe start date of the usage period for metered entitlements with a reset period configured
USAGE_PERIOD_ENDTIMESTAMP_TZThe end date of the usage period for metered entitlements with a reset period configured
RESET_PERIODVARCHAREnum. Reset period for the entitlement. Can be one of: MONTH, WEEK, DAY, HOUR.
RESET_PERIOD_MONTHLY_ACCORDING_TOVARCHAREnum. Configuration for the monthly reset period. Can be one of: SubscriptionStart, StartOfTheMonth.
RESET_PERIOD_WEEKLY_ACCORDING_TOVARCHAREnum. Configuration for the weekly reset period. Can be one of: SubscriptionStart, EverySunday, EveryMonday, EveryTuesday, EveryWednesday, EveryThursday, EveryFriday, EverySaturday.

Usage Measurement

Represents calculated usage reports associated with a customer for a metered feature.

Table: USAGE_MEASUREMENTS

ColumnTypeMandatoryDescription
IDVARCHARYesUsage measurement internal identifier
CUSTOMER_IDVARCHARYesCustomer identifier
RESOURCE_IDVARCHARResource identifier
FEATURE_IDVARCHARYesFeature identifier
CREATED_ATTIMESTAMP_TZYesCreation date and time of the usage measurement
UPDATED_ATTIMESTAMP_TZYesLast update date and time of the usage measurement
VALUENUMBERYesReported usage value reflects a change in usage, i.e., the delta, at the time of the report
RESET_PERIODVARCHAREnum. Reset period for the entitlement of the measurement. Can be one of: MONTH, WEEK, DAY, HOUR.
PERIOD_STARTTIMESTAMP_TZReset period window start time
PERIOD_ENDTIMESTAMP_TZReset period window end time
ENVIRONMENT_IDVARCHARYesIdentifier for the associated environment

Usage Events

Represents the raw usage events associated with a customer.

πŸ“˜

To enable reporting of raw usage events, please contact Stigg support.

Table: USAGE_EVENTS_<ENVIRONMENT_ID>

ColumnTypeMandatoryDescription
IDVARCHARYesUsage event internal identifier
CUSTOMER_IDVARCHARYesCustomer identifier
RESOURCE_IDVARCHARResource identifier
EVENT_NAMEVARCHARYesThe name of the event
CREATED_ATTIMESTAMP_TZYesCreation time injested of the event
TIMESTAMPTIMESTAMP_TZYesThe timestamp of the event (What is passed to the request)
DIMENSIONSVARCHARYesAdditional dimensions of the event which are used for the filtering and aggregation
IDEMPOTENCY_KEYVARCHARYesThe events unique key.
ENVIRONMENT_IDVARCHARYesIdentifier for the associated environment

πŸ“˜

When enabled, the usage_events table will also include events of calculated usage reports that were made to Stigg. Such reports will appear as $usage.reported events.

Coupon

Represents a discount coupon that can be applied to a customer.

Table: COUPONS

ColumnTypeMandatoryDescription
IDVARCHARYesCoupon internal identifier
COUPON_IDVARCHARYesCoupon identifier
NAMEVARCHARYesCoupon name
DESCRIPTIONVARCHARCoupon description
BILLING_IDVARCHARIdentifier of the coupon in the billing solution that’s integrated with Stigg, i.e. Stripe ID
BILLING_LINK_URLVARCHARURL for the coupon entity in the billing solution that’s integrated with Stigg
CREATED_ATTIMESTAMP_TZYesCreation date and time of the coupon
UPDATED_ATTIMESTAMP_TZYesLast update date and time of the coupon
TYPEVARCHARYesEnum. Coupon discount type. Can be one of: FIXED, PERCENTAGE.
DISCOUNT_VALUENUMBERYesRepresents the discount value either a fixed or percentage amount.
Note: this field is deprecated, please use PERCENT_OFF and AMOUNTS_OFF instead.
AMOUNTS_OFFVARCHARFixed price discounts in multiple-currency. List of JSON objects with the following structure: { amount: Float!; currency: String!; }
PERCENT_OFFNUMBERPercentage off discount
STATUSVARCHARYesEnum. Coupon status. Can be one of: ACTIVE, ARCHIVED.
ADDITIONAL_META_DATAVARCHARAdditional metadata
ENVIRONMENT_IDVARCHARYesIdentifier for the associated environment