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
Column | Type | Mandatory | Description |
---|---|---|---|
CUSTOMER_ID | VARCHAR | Yes | Customer identifier |
VARCHAR | Email address | ||
NAME | VARCHAR | Customer name | |
BILLING_CURRENCY | VARCHAR | Preferred billing currency e.g USD | |
BILLING_ID | VARCHAR | Identifier of the customer in the billing solution thatβs integrated with Stigg, i.e. Stripe ID | |
BILLING_LINK_URL | VARCHAR | URL for the customer entity in the billing solution thatβs integrated with Stigg | |
DEFAULT_PAYMENT_EXPIRATION_MONTH | NUMBER | Expiration month of the customerβs default payment method | |
DEFAULT_PAYMENT_EXPIRATION_YEAR | NUMBER | Expiration year of the customerβs default payment method | |
DEFAULT_PAYMENT_METHOD_ID | VARCHAR | ID of the customerβs default payment method in the billing solution (Stripe ID) | |
DEFAULT_PAYMENT_METHOD_LAST4_DIGITS | VARCHAR | Last 4 digits of customerβs default payment method | |
DEFAULT_PAYMENT_METHOD_TYPE | VARCHAR | Enum. Type of default payment method. One of: CARD, BANK | |
DELETED_AT | TIMESTAMP_TZ | Date and time of when the customer was archived | |
ENVIRONMENT_ID | VARCHAR | Yes | Environment identifier |
HAS_ACTIVE_SUBSCRIPTION | BOOLEAN | Yes | Has an active subscription |
ID | VARCHAR | Yes | Customer internal identifier in Stigg |
UPDATED_AT | TIMESTAMP_TZ | Yes | Last update date and time |
CREATED_AT | TIMESTAMP_TZ | Yes | Creation date and time |
ADDITIONAL_META_DATA | VARCHAR | Additional metadata JSON in a text format | |
COUPON_ID | VARCHAR | Coupon 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
Column | Type | Mandatory | Description |
---|---|---|---|
ENVIRONMENT_ID | VARCHAR | Yes | Environment identifier |
RESOURCE_ID | VARCHAR | Yes | Resource identifier |
CUSTOMER_ID | VARCHAR | Yes | Customer identifier |
CREATED_AT | TIMESTAMP_TZ | Yes | Creation date and time |
UPDATED_AT | TIMESTAMP_TZ | Yes | Last 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
Column | Type | Mandatory | Description |
---|---|---|---|
SUBSCRIPTION_ID | VARCHAR | Yes | Subscription Identifier |
ENVIRONMENT_ID | VARCHAR | Yes | Environment identifier |
ID | VARCHAR | Yes | Subscription internal identifier |
CREATED_AT | TIMESTAMP_TZ | Yes | Creation date and time |
UPDATED_AT | TIMESTAMP_TZ | Yes | Last update date and time |
START_DATE | TIMESTAMP_TZ | Yes | Subscription start date |
END_DATE | TIMESTAMP_TZ | Subscription end date | |
CANCELLATION_DATE | TIMESTAMP_TZ | Date of subscription cancellation | |
TRIAL_END_DATE | TIMESTAMP_TZ | End date of trial period | |
BILLING_ID | VARCHAR | Billing identifier (Stripe ID) of the subscription | |
OLD_BILLING_ID | VARCHAR | Previous billing identifier (Stripe ID), is set only for canceled or expired subscriptions. | |
BILLING_LINK_URL | VARCHAR | URL for the subscription entity in the billing solution (Stripe ID) | |
STATUS | VARCHAR | Yes | Enum. Subscription status. Can be one of: PAYMENT_PENDING, ACTIVE, EXPIRED, IN_TRIAL, CANCELED, NOT_STARTED. |
RESOURCE_ID | VARCHAR | Resource identifier | |
IS_CUSTOM_PRICE_SUBSCRIPTION | BOOLEAN | Indicates if subscription has custom pricing (i.e. not self-served) | |
CURRENT_BILLING_PERIOD_START | TIMESTAMP_TZ | Start of the current billing period | |
CURRENT_BILLING_PERIOD_END | TIMESTAMP_TZ | End of the current billing period | |
PRICING_TYPE | VARCHAR | Yes | Enum. Type of pricing applied. Can be one of: FREE, PAID,CUSTOM. |
ADDITIONAL_META_DATA | VARCHAR | Additional metadata | |
PAYMENT_COLLECTION | VARCHAR | Yes | Enum. Payment collection status. Can be one of: NOT_REQUIRED, PROCESSING, FAILED, ACTION_REQUIRED (= 3DS). |
CUSTOMER_ID | VARCHAR | Yes | Associated customer identifier |
PLAN_ID | VARCHAR | Yes | Subscription plan identifier |
COUPON_ID | VARCHAR | This 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
Column | Type | Mandatory | Description |
---|---|---|---|
ID | VARCHAR | Yes | Price internal identifier |
CREATED_AT | TIMESTAMP_TZ | Yes | Creation date and time |
UPDATED_AT | TIMESTAMP_TZ | Yes | Last update date and time |
USAGE_LIMIT | NUMBER | Usage limit associated with the price | |
FEATURE_ID | VARCHAR | Identifier for the associated feature, if this price represents a billable metric | |
BILLING_MODEL | VARCHAR | Enum. Billing model used. Can be one of: FLAT_FEE, PER_UNIT, USAGE_BASED. | |
SUBSCRIPTION_ID | VARCHAR | Yes | Associated subscription identifier |
PRICE_ID | VARCHAR | Associated plan or add-on price identifier | |
ENVIRONMENT_ID | VARCHAR | Yes | Environment identifier |
Subscription Add-on
Represents the quantity of an add-on that is included in the subscription.
Table: SUBSCRIPTION_ADDONS
Column | Type | Mandatory | Description |
---|---|---|---|
ID | VARCHAR | Yes | SubscriptionAddon internal identifier |
QUANTITY | NUMBER | Yes | Quantity of the add-on |
CREATED_AT | TIMESTAMP_TZ | Yes | Creation date and time |
UPDATED_AT | TIMESTAMP_TZ | Yes | Last update date and time |
SUBSCRIPTION_ID | VARCHAR | Yes | Associated subscription identifier |
ADDON_ID | VARCHAR | Yes | Associated add-on identifier |
PRICE_ID | VARCHAR | Associated plan or add-on price identifier | |
ENVIRONMENT_ID | VARCHAR | Yes | Environment identifier |
Subscription Applied Coupons
Represents a coupon entity attached to a subscription.
Table: SUBSCRIPTION_APPLIED_COUPONS
Column | Type | Mandatory | Description |
---|---|---|---|
ID | VARCHAR | Yes | Internal identifier |
ENVIRONMENT_ID | VARCHAR | Yes | Environment identifier |
CREATED_AT | TIMESTAMP_TZ | Yes | Creation date and time |
UPDATED_AT | TIMESTAMP_TZ | Yes | Last update date and time |
DELETED_AT | VARCHAR | Date and time the coupon was removed from the subscription | |
SUBSCRIPTION_ID | VARCHAR | Yes | Associated subscription identifier |
COUPON_ID | VARCHAR | Yes | Associated coupon identifier |
STATUS | VARCHAR | Yes | Enum - 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
Column | Type | Mandatory | Description |
---|---|---|---|
ID | VARCHAR | Yes | Product internal identifier |
DISPLAY_NAME | VARCHAR | Display name of the product | |
PRODUCT_ID | VARCHAR | Yes | Product identifier |
DESCRIPTION | VARCHAR | Description of the product | |
CREATED_AT | TIMESTAMP_TZ | Yes | Creation date and time of the product |
UPDATED_AT | TIMESTAMP_TZ | Yes | Last update date and time |
ENVIRONMENT_ID | VARCHAR | Yes | Identifier for the associated environment |
MULTIPLE_SUBSCRIPTIONS | BOOLEAN | Yes | Supports multiple subscriptions, each resource can have a separate subscription |
ADDITIONAL_META_DATA | VARCHAR | Additional 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
Column | Type | Mandatory | Description |
---|---|---|---|
ID | VARCHAR | Yes | Plan internal identifier |
CREATED_AT | TIMESTAMP_TZ | Yes | Creation date and time of the plan |
UPDATED_AT | TIMESTAMP_TZ | Yes | Last update date and time of the plan |
PLAN_ID | VARCHAR | Yes | Plan identifier |
BILLING_ID | VARCHAR | Billing identifier (Stripe ID) | |
BILLING_LINK_URL | VARCHAR | URL for billing information | |
DISPLAY_NAME | VARCHAR | Yes | Display name of the plan |
PRICING_TYPE | VARCHAR | Enum. Type of pricing used for the plan. Can be one of: FREE, PAID, CUSTOM. | |
DESCRIPTION | VARCHAR | Description of the plan | |
ENVIRONMENT_ID | VARCHAR | Yes | Identifier for the associated environment |
IS_LATEST | BOOLEAN | Indicates if this is the latest version of the plan | |
VERSION_NUMBER | NUMBER | Version number of the plan | |
ADDITIONAL_META_DATA | VARCHAR | Additional metadata for the plan | |
PRODUCT_ID | VARCHAR | Yes | Associated product identifier |
BASE_PLAN_ID | VARCHAR | Parent 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
Column | Type | Mandatory | Description |
---|---|---|---|
ID | VARCHAR | Yes | Add-on internal identifier |
CREATED_AT | TIMESTAMP_TZ | Yes | Creation date and time |
UPDATED_AT | TIMESTAMP_TZ | Yes | Last update date and time |
ADDON_ID | VARCHAR | Yes | Add-on identifier |
BILLING_ID | VARCHAR | Billing identifier (Stripe ID) | |
BILLING_LINK_URL | VARCHAR | URL for billing information of the add-on | |
DISPLAY_NAME | VARCHAR | Yes | Display name of the add-on |
PRICING_TYPE | VARCHAR | Enum. Pricing type used for the add-on. Can be one of: FREE, PAID, CUSTOM. For add-ons, the value is always PAID. | |
DESCRIPTION | VARCHAR | Description of the add-on | |
ENVIRONMENT_ID | VARCHAR | Identifier for the associated environment | |
PRODUCT_ID | VARCHAR | Identifier for the associated product | |
IS_LATEST | BOOLEAN | Indicates if this is the latest version of the add-on | |
VERSION_NUMBER | NUMBER | Yes | Version number of the add-on |
ADDITIONAL_META_DATA | VARCHAR | Additional metadata for the add-on |
Price
Represents the price of a package and its settings.
Table: PRICES
Column | Type | Mandatory | Description |
---|---|---|---|
ID | VARCHAR | Yes | Price internal identifier |
CREATED_AT | TIMESTAMP_TZ | Yes | Creation date and time of the price |
UPDATED_AT | TIMESTAMP_TZ | Yes | Last update date and time |
BILLING_PERIOD | VARCHAR | Yes | Enum. Billing period associated with the price. Can be one of: MONTHLY, ANNUALLY. |
BILLING_MODEL | VARCHAR | Yes | Enum. Billing model used for this price. Can be one of: FLAT_FEE, PER_UNIT, USAGE_BASED. |
BILLING_ID | VARCHAR | Billing identifier associated with the price | |
PRICE_AMOUNT | NUMBER | Monetary value of the price | |
PRICE_CURRENCY | VARCHAR | Currency of the price | |
BILLING_COUNTRY_CODE | VARCHAR | Country code for billing | |
FEATURE_ID | VARCHAR | Identifier for the associated feature | |
MIN_UNIT_QUANTITY | NUMBER | Minimum unit quantity for applying this price | |
PACKAGE_ID | VARCHAR | Identifier for the associated package, can belong to a plan or an add-on | |
MAX_UNIT_QUANTITY | NUMBER | Maximum unit quantity for applying this price | |
ENVIRONMENT_ID | VARCHAR | Yes | Environment identifier |
TIERS_MODE | VARCHAR | Enum. Mode of tiers for the price, if pricing is tiered. Can be one of: VOLUME, VOLUME_PER_UNIT, GRADUATED. | |
TIERS | VARCHAR | Tiers 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
Column | Type | Mandatory | Description |
---|---|---|---|
ID | VARCHAR | Yes | Unique identifier for the package entitlement |
DESCRIPTION | VARCHAR | Description of the package entitlement | |
FEATURE_ID | VARCHAR | Yes | Identifier for the associated feature |
PACKAGE_ID | VARCHAR | Yes | Identifier for the associated package |
CREATED_AT | TIMESTAMP_TZ | Creation date and time of the package entitlement | |
UPDATED_AT | TIMESTAMP_TZ | Last update date and time of the package entitlement | |
USAGE_LIMIT | NUMBER | Usage limit for the entitlement | |
HAS_UNLIMITED_USAGE | BOOLEAN | Indicates if the entitlement has unlimited usage | |
IS_CUSTOM | BOOLEAN | Indicates if the entitlement is custom | |
ENVIRONMENT_ID | VARCHAR | Yes | Identifier for the associated environment |
RESET_PERIOD | VARCHAR | Enum. 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
Column | Type | Mandatory | Description |
---|---|---|---|
ID | VARCHAR | Yes | Unique identifier for the promotional entitlement |
DESCRIPTION | VARCHAR | Description of the promotional entitlement | |
CUSTOMER_ID | VARCHAR | Yes | Associated customer identifier |
FEATURE_ID | VARCHAR | Yes | Identifier for the associated feature |
CREATED_AT | TIMESTAMP_TZ | Yes | Creation date and time of the entitlement |
UPDATED_AT | TIMESTAMP_TZ | Yes | Last update date and time of the entitlement |
START_DATE | TIMESTAMP_TZ | Yes | Start date of the promotional entitlement |
END_DATE | TIMESTAMP_TZ | End date of the promotional entitlement | |
USAGE_LIMIT | NUMBER | Usage limit for the entitlement | |
HAS_UNLIMITED_USAGE | BOOLEAN | Indicates if the entitlement has unlimited usage | |
STATUS | VARCHAR | Yes | Enum. Status of the promotional entitlement. Can be one of: Active, Expired, Paused. |
PERIOD | VARCHAR | Yes | Enum. Period of the promotional entitlement. Can be one of: ONE_WEEK, ONE_MONTH, SIX_MONTH, ONE_YEAR, LIFETIME, CUSTOM. |
RESET_PERIOD | VARCHAR | Enum. Reset period for the entitlement. Can be one of: MONTH, WEEK, DAY, HOUR. | |
ENVIRONMENT_ID | VARCHAR | Identifier for the associated environment |
Feature
Represents a configurable functionality in the product that can be monetized.
Table: FEATURES
Column | Type | Mandatory | Description |
---|---|---|---|
ID | VARCHAR | Yes | Feature internal identifier |
DISPLAY_NAME | VARCHAR | Yes | Display name of the feature |
FEATURE_ID | VARCHAR | Yes | Feature identifier |
CREATED_AT | TIMESTAMP_TZ | Yes | Creation date and time of the feature |
UPDATED_AT | TIMESTAMP_TZ | Yes | Last update date and time of the feature |
FEATURE_UNITS | VARCHAR | Units in which the feature is measured | |
FEATURE_UNITS_PLURAL | VARCHAR | Plural form of the feature units | |
DESCRIPTION | VARCHAR | Description of the feature | |
FEATURE_TYPE | VARCHAR | Yes | Enum. Type of the feature. Can be one of: BOOLEAN, NUMBER. |
METER_TYPE | VARCHAR | Enum. Meter type of the feature. Can be one of: None, Fluctuating, Incremental. | |
ENVIRONMENT_ID | VARCHAR | Yes | Identifier for the associated environment |
ADDITIONAL_META_DATA | VARCHAR | Additional 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
Column | Type | Mandatory | Description |
---|---|---|---|
ID | VARCHAR | Yes | Entitlement internal identifier |
CREATED_AT | TIMESTAMP_TZ | Yes | Creation date and time of the entitlement |
UPDATED_AT | TIMESTAMP_TZ | Yes | Last update date and time of the entitlement |
ENVIRONMENT_ID | VARCHAR | Yes | Identifier for the associated environment |
CUSTOMER_UUID | VARCHAR | Yes | Customer internal identifier |
CUSTOMER_ID | VARCHAR | Yes | Customer identifier |
RESOURCE_UUID | VARCHAR | Resource internal identifier | |
RESOURCE_ID | VARCHAR | Resource identifier | |
FEATURE_UUID | VARCHAR | Yes | Feature internal identifier |
FEATURE_ID | VARCHAR | Yes | Feature identifier |
IS_DELETED | BOOLEAN | Yes | Indicates whether the entitlement was deleted and is no longer applicable |
CURRENT_USAGE | NUMBER | Current usage of the entitlement | |
USAGE_LIMIT | NUMBER | Usage limit for the entitlement | |
HAS_UNLIMITED_USAGE | BOOLEAN | Indicates if the entitlement has unlimited usage | |
USAGE_PERIOD_ANCHOR | TIMESTAMP_TZ | The anchor for calculating the usage period for metered entitlements with a reset period configured | |
USAGE_PERIOD_START | TIMESTAMP_TZ | The start date of the usage period for metered entitlements with a reset period configured | |
USAGE_PERIOD_END | TIMESTAMP_TZ | The end date of the usage period for metered entitlements with a reset period configured | |
RESET_PERIOD | VARCHAR | Enum. Reset period for the entitlement. Can be one of: MONTH, WEEK, DAY, HOUR. | |
RESET_PERIOD_MONTHLY_ACCORDING_TO | VARCHAR | Enum. Configuration for the monthly reset period. Can be one of: SubscriptionStart, StartOfTheMonth. | |
RESET_PERIOD_WEEKLY_ACCORDING_TO | VARCHAR | Enum. 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
Column | Type | Mandatory | Description |
---|---|---|---|
ID | VARCHAR | Yes | Usage measurement internal identifier |
CUSTOMER_ID | VARCHAR | Yes | Customer identifier |
RESOURCE_ID | VARCHAR | Resource identifier | |
FEATURE_ID | VARCHAR | Yes | Feature identifier |
CREATED_AT | TIMESTAMP_TZ | Yes | Creation date and time of the usage measurement |
UPDATED_AT | TIMESTAMP_TZ | Yes | Last update date and time of the usage measurement |
VALUE | NUMBER | Yes | Reported usage value reflects a change in usage, i.e., the delta, at the time of the report |
RESET_PERIOD | VARCHAR | Enum. Reset period for the entitlement of the measurement. Can be one of: MONTH, WEEK, DAY, HOUR. | |
PERIOD_START | TIMESTAMP_TZ | Reset period window start time | |
PERIOD_END | TIMESTAMP_TZ | Reset period window end time | |
ENVIRONMENT_ID | VARCHAR | Yes | Identifier 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>
Column | Type | Mandatory | Description |
---|---|---|---|
ID | VARCHAR | Yes | Usage event internal identifier |
CUSTOMER_ID | VARCHAR | Yes | Customer identifier |
RESOURCE_ID | VARCHAR | Resource identifier | |
EVENT_NAME | VARCHAR | Yes | The name of the event |
CREATED_AT | TIMESTAMP_TZ | Yes | Creation time injested of the event |
TIMESTAMP | TIMESTAMP_TZ | Yes | The timestamp of the event (What is passed to the request) |
DIMENSIONS | VARCHAR | Yes | Additional dimensions of the event which are used for the filtering and aggregation |
IDEMPOTENCY_KEY | VARCHAR | Yes | The events unique key. |
ENVIRONMENT_ID | VARCHAR | Yes | Identifier 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
Column | Type | Mandatory | Description |
---|---|---|---|
ID | VARCHAR | Yes | Coupon internal identifier |
COUPON_ID | VARCHAR | Yes | Coupon identifier |
NAME | VARCHAR | Yes | Coupon name |
DESCRIPTION | VARCHAR | Coupon description | |
BILLING_ID | VARCHAR | Identifier of the coupon in the billing solution thatβs integrated with Stigg, i.e. Stripe ID | |
BILLING_LINK_URL | VARCHAR | URL for the coupon entity in the billing solution thatβs integrated with Stigg | |
CREATED_AT | TIMESTAMP_TZ | Yes | Creation date and time of the coupon |
UPDATED_AT | TIMESTAMP_TZ | Yes | Last update date and time of the coupon |
TYPE | VARCHAR | Yes | Enum. Coupon discount type. Can be one of: FIXED, PERCENTAGE. |
DISCOUNT_VALUE | NUMBER | Yes | Represents the discount value either a fixed or percentage amount. Note: this field is deprecated, please use PERCENT_OFF and AMOUNTS_OFF instead. |
AMOUNTS_OFF | VARCHAR | Fixed price discounts in multiple-currency. List of JSON objects with the following structure: { amount: Float!; currency: String!; } | |
PERCENT_OFF | NUMBER | Percentage off discount | |
STATUS | VARCHAR | Yes | Enum. Coupon status. Can be one of: ACTIVE , ARCHIVED . |
ADDITIONAL_META_DATA | VARCHAR | Additional metadata | |
ENVIRONMENT_ID | VARCHAR | Yes | Identifier for the associated environment |
Updated 7 days ago