CompanyProductInventoryLogs


Columns

Column Type Size Nulls Auto Default Children Parents Comments
id uuid 2147483647 gen_random_uuid()
CompanyProductInventoryAddThroughCreditLogs.companyProductInventoryLogId CompanyProductInventoryAddTh_companyProductInventoryLogId_fkey2 C
CompanyProductInventoryAddThroughFreeTrialOfferLogs.companyProductInventoryLogId CompanyProductInventoryAddTh_companyProductInventoryLogId_fkey5 C
CompanyProductInventoryAddThroughOfflineSalesLogs.companyProductInventoryLogId CompanyProductInventoryAddTh_companyProductInventoryLogId_fkey1 C
CompanyProductInventoryAddThroughPurchaseLogs.companyProductInventoryLogId CompanyProductInventoryAddThr_companyProductInventoryLogId_fkey C
CompanyProductInventoryAddThroughSalesTransactionLogs.companyProductInventoryLogId CompanyProductInventoryAddTh_companyProductInventoryLogId_fkey3 C
CompanyProductInventoryAddThroughSubscriptionLogs.companyProductInventoryLogId CompanyProductInventoryAddTh_companyProductInventoryLogId_fkey4 C
CompanyProductInventoryAmountExpiryLogs.companyProductInventoryLogId CompanyProductInventoryAmount_companyProductInventoryLogId_fkey C
CompanyProductInventorySubscriptionLogs.companyProductInventoryLogId CompanyProductInventorySubscr_companyProductInventoryLogId_fkey C
CompanyProductInventoryUsageAfterCreditProductPurchaseLogs.companyProductInventoryLogId CompanyProductInventoryUsage_companyProductInventoryLogId_fkey1 C
CompanyProductInventoryUsageAfterPurchaseLogs.companyProductInventoryLogId CompanyProductInventoryUsageA_companyProductInventoryLogId_fkey C
CompanyProductInventoryUsageFromBalanceLogs.companyProductInventoryLogId CompanyProductInventoryUsageF_companyProductInventoryLogId_fkey C
JobProductInventoryAddViaCompanyProductUsageLogs.companyProductInventoryLogId JobProductInventoryAddViaComp_companyProductInventoryLogId_fkey N
companyId uuid 2147483647 null
Companies.id CompanyProductInventoryLogs_companyId_fkey C
productId uuid 2147483647 null
Products.id CompanyProductInventoryLogs_productId_fkey C
type "employer_purchases"."enum_EmployerPurchases_CompanyProductInventoryLogs_type" 2147483647 null
amount int4 10 null

Represents the amount added/used for a particular product

finalBalance int4 10 null

Represents the balance after the job product operation is done

createdAt timestamptz 35,6 now()
expiryDateTime timestamptz 35,6 √ null

Represents the end date of a company product balance being set during this event

userId uuid 2147483647 √ null
Users.id CompanyProductInventoryLogs_userId_fkey N
timePeriod numeric 0 √ null
timePeriodUnit "employer_purchases"."enum_employer_purchases_timePeriodUnit" 2147483647 √ null
timePeriodValidityType "employer_purchases"."enum_employer_purchases_timePeriodValidityType" 2147483647 √ null
skuId uuid 2147483647 √ null
PaidProducts.skuId CompanyProductInventoryLogs_skuId_fkey R
changeType "employer_purchases"."enum_CompanyProductInventoryLogs_changeType" 2147483647 √ null
reason "employer_purchases"."enum_CompanyProductInventoryLogs_reason" 2147483647 √ null

ChangeType = ADDITION: PURCHASE, GIFT, ADMIN_ADD_PAID, ADMIN_ADD_FREE | ChangeType = DEDUCTION: USAGE, EXPIRY, ADMIN_DEDUCT

referenceId varchar 64 √ null
context jsonb 2147483647 √ null
autoId bigserial 19 √ √ nextval('employer_purchases."CompanyProductInventoryLogs_autoId_seq"'::regclass)

Indexes

Constraint Name Type Sort Column(s)
CompanyProductInventoryLogs_pkey Primary key Asc id
CompanyProductInventoryLogs_companyId_createdAt_id_partialIdx Performance Asc/Desc/Desc companyId + createdAt + id
CPIL_companyId_productType_changeType_createdAt_id_partialIdx Performance Asc/Asc/Desc/Desc companyId + changeType + createdAt + id

Check Constraints

Constraint Name Constraint
CompanyProductInventoryLogs_amount_check (((amount)::numeric >= (0)::numeric))
CompanyProductInventoryLogs_finalBalance_check ((("finalBalance")::numeric >= (0)::numeric))
timePeriod_columns_check (((("timePeriod" IS NOT NULL) AND ("timePeriod" > (0)::numeric) AND ("timePeriodUnit" IS NOT NULL) AND ("timePeriodValidityType" IS NOT NULL)) OR (("timePeriod" IS NULL) AND ("timePeriodUnit" IS NULL) AND ("timePeriodValidityType" IS NULL))))

Relationships