CompanyPurchaseSubscriptions


Columns

Column Type Size Nulls Auto Default Children Parents Comments
id uuid 2147483647 gen_random_uuid()
CompanyVirtualProductOrders.subscriptionId CompanyVirtualProductOrders_subscriptionId_fkey R
companyId uuid 2147483647 null
Companies.id CompanyPurchaseSubscriptions_companyId_fkey R
userId uuid 2147483647 null
Users.id CompanyPurchaseSubscriptions_userId_fkey R
orderType "employer_purchases"."enum_CompanyPurchaseSubscriptions_orderType" 2147483647 null
orderNumber varchar 64 null
CompanyVirtualProductOrders.orderNumber CompanyPurchaseSubscriptions_orderNumber_fkey R

References the order number of the originating order that created this subscription. The source order must exist in CompanyVirtualProductOrders with purchaseType = SUBSCRIPTION.

status "employer_purchases"."enum_CompanyPurchaseSubscriptions_status" 2147483647 null
cancelReason varchar 255 √ null
billingInterval jsonb 2147483647 null
nextRenewalTime timestamptz 35,6 √ null
expiryTime timestamptz 35,6 √ null
paidAmount numeric 15,2 0
currency varchar 8 √ null
Currencies.code CompanyPurchaseSubscriptions_currency_fkey R
paymentProvider "employer_purchases"."enum_CompanyPurchaseSubscriptions_paymentProvider" 2147483647 √ null
paymentMethod varchar 20 √ null
agreementNumber varchar 255 √ null

The recurring charge agreement identifier returned by the payment provider, used to schedule and execute automatic billing on subsequent renewal cycles.

agreementInfo jsonb 2147483647 √ null

The raw response payload returned by the payment provider’s subscription or agreement API at the time the agreement was established. Preserved as-is for audit and debugging purposes.

failedChargeCount int4 10 0
lastRenewedAt timestamptz 35,6 √ null
createdAt timestamptz 35,6 now()
updatedAt timestamptz 35,6 now()
orderSource "employer_purchases"."enum_CompanyPurchaseSubscriptions_orderSource" 2147483647 null
renewalMode "employer_purchases"."enum_CompanyPurchaseSubscriptions_renewalMode" 2147483647 null
referenceId varchar 255 null
currentBillingCycle varchar 16 √ null

Tracks the current billing cycle for subscription-based orders. Sequential cycle number: ‘1’ is the initial period, ‘2’ is the first renewal, ‘3’ is the second renewal, etc. Null for non-subscription order types.

processingStatus "employer_purchases"."enum_CompanyPurchaseSubscriptions_processingStatus" 2147483647 'PENDING'::employer_purchases."enum_CompanyPurchaseSubscriptions_processingStatus"

Indexes

Constraint Name Type Sort Column(s)
CompanyPurchaseSubscriptions_pkey Primary key Asc id
CompanyPurchaseSubscriptions_agreementNumber_idx Performance Asc agreementNumber
CompanyPurchaseSubscriptions_companyId_idx Performance Asc companyId
CompanyPurchaseSubscriptions_createdAt_idx Performance Asc createdAt
CompanyPurchaseSubscriptions_lastRenewedAt_idx Performance Asc lastRenewedAt
CompanyPurchaseSubscriptions_nextRenewalTime_idx Performance Asc nextRenewalTime
CompanyPurchaseSubscriptions_orderNumber_key Must be unique Asc orderNumber
CompanyPurchaseSubscriptions_orderType_idx Performance Asc orderType
CompanyPurchaseSubscriptions_paymentProvider_idx Performance Asc paymentProvider
CompanyPurchaseSubscriptions_referenceId_key Must be unique Asc referenceId
CompanyPurchaseSubscriptions_status_idx Performance Asc status
CompanyPurchaseSubscriptions_userId_idx Performance Asc userId

Relationships