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

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

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

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.

Snowflake 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

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

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

SubscriptionAddon

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

Snowflake table: SUBSCRIPTION_ADDONS

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

Product

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

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

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

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

Snowflake 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!; }

PackageEntitlement

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

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

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

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.

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


Snowflake 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
NEXT_RESET_DATETIMESTAMP_TZDate when the usage limit resets next
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.

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.