Schema
Learn how Stigg entities are mapped to Snowflake entities when Stigg is integrated with Snowflake
Available data types
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.
Snowflake 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 |
CustomerResource
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.
Snowflake 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.
Snowflake 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 |
SubscriptionPrice
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
Snowflake 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 |
SubscriptionAddon
Represents the quantity of an add-on that is included in the subscription.
Snowflake table: SUBSCRIPTION_ADDONS
Column | Type | Mandatory | Description |
---|---|---|---|
ID | VARCHAR | Yes | SubscriptionAddon internal identifier |
QUANTITY | NUMBER | Yes | Quantity of the add-on |
UPDATED_AT | TIMESTAMP_TZ | Yes | Last update date and time |
CREATED_AT | TIMESTAMP_TZ | Yes | Creation 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 |
Product
Represents a product or product line. Typically, products group together plans and add-ons.
Snowflake 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.
Snowflake 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.
Snowflake 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.
Snowflake 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!; } |
PackageEntitlement
Represents a feature entitlement associated with a plan or add-on.
Snowflake 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. |
PromotionalEntitlement
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.
Snowflake 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.
Snowflake 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.
Snowflake 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 | |
NEXT_RESET_DATE | TIMESTAMP_TZ | Date when the usage limit resets next | |
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. |
Data type relations
The following diagram describes the relations between the available data types:
Additional 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.
Updated about 2 months ago