Wiki 🔍 Search
Platform data architecture

QIIUB — Entity Relationship Diagram

Created: 2026-07-22Last updated: 2026-08-17

Legend

||--o{ Mandatory one-to-many (required parent)
|o--o{ Optional one-to-many (nullable parent)
PK Primary Key
FK Foreign Key
UK Unique
Every table is tenant-scoped by MerchantId (part of the composite primary key and every foreign key); it is omitted from boxes and edge labels for readability, and only in the Merchant database.
Each diagram shows relationships within its area; foreign keys that cross areas are omitted here for readability and are listed in the data dictionary.
Schema is dbo unless a table is labeled auth or email.
149
Tables total
39
Central
110
Merchant

Central Database

AI / Agents

AI credit plans, wallets, prompts, and the request log that meters every AI call.

erDiagram
  AiCreditAccount {
    int Id PK
    int MerchantId FK, UK
    varchar_32 PublicId UK
  }
  AiCreditPlan {
    int Id PK
    varchar_50 Key UK
    varchar_32 PublicId UK
  }
  AiCreditTransaction {
    int Id PK
    int AccountId FK
    bigint AiRequestLogId FK
  }
  AiPrompt {
    int Id PK
    varchar_100 Key UK
    varchar_32 PublicId UK
  }
  AiRequestLog {
    bigint Id PK
    int PromptId FK
    varchar_32 PublicId UK
  }
  AiCreditAccount ||--o{ AiCreditTransaction : "AccountId"
  AiRequestLog |o--o{ AiCreditTransaction : "AiRequestLogId"
  AiPrompt ||--o{ AiRequestLog : "PromptId"

Audit

Change/action audit trail.

erDiagram
  SystemAuditLog {
    bigint Id PK
    int MerchantId FK
    int PartnerId FK
    nvarchar_450 UserId FK
  }

Devices

Registered POS/terminal devices and their activation and IoT identity.

erDiagram
  DeviceRegistration {
    int Id PK
    int MerchantId FK
    varchar_50 ActivationToken UK
    varbinary_32 DeviceTokenHash UK
    varchar_32 PublicId UK
  }

Identity (framework)

Built-in ASP.NET Core Identity tables (users, roles, claims, logins, tokens).

erDiagram
  AspNetRoleClaims {
    int Id PK
    nvarchar_450 RoleId FK
  }
  AspNetRoles {
    nvarchar_450 Id PK
    nvarchar_256 NormalizedName UK
  }
  AspNetUserClaims {
    int Id PK
    nvarchar_450 UserId FK
  }
  AspNetUserLogins {
    nvarchar_450 LoginProvider PK
    nvarchar_450 ProviderKey PK
    nvarchar_450 UserId FK
  }
  AspNetUserRoles {
    nvarchar_450 UserId PK
    nvarchar_450 RoleId PK
  }
  AspNetUsers {
    nvarchar_450 Id PK
    nvarchar_256 NormalizedUserName UK
  }
  AspNetUserTokens {
    nvarchar_450 UserId PK
    nvarchar_450 LoginProvider PK
    nvarchar_450 Name PK
  }
  AspNetRoles ||--o{ AspNetRoleClaims : "RoleId"
  AspNetUsers ||--o{ AspNetUserClaims : "UserId"
  AspNetUsers ||--o{ AspNetUserLogins : "UserId"
  AspNetRoles ||--o{ AspNetUserRoles : "RoleId"
  AspNetUsers ||--o{ AspNetUserRoles : "UserId"
  AspNetUsers ||--o{ AspNetUserTokens : "UserId"

Identity & Auth

Users, external logins, invitations, and the passwordless/session tokens that authenticate them.

erDiagram
  AuthDomainRoute {
    int Id PK
    varchar_256 Domain UK
  }
  ExternalLogin {
    int Id PK
    nvarchar_450 UserId FK
  }
  HandoffToken {
    int Id PK
    varchar_64 Token UK
  }
  Invitation {
    int Id PK
    nvarchar_450 AcceptedByUserId FK
    nvarchar_450 InvitedByUserId FK
    int PartnerId FK
    varchar_32 PublicId UK
    varchar_64 Token UK
  }
  MagicLinkToken {
    int Id PK
    varchar_64 Token UK
  }
  RefreshToken {
    bigint Id PK
    binary_32 TokenHash UK
  }
  UserMerchant {
    int Id PK
    int MerchantId FK
    nvarchar_450 UserId FK
  }

Loyalty Groups (cross-merchant)

Loyalty programs, accounts, and points shared across a merchant group.

erDiagram
  GroupLoyaltyAccount {
    bigint Id PK
    int GroupLoyaltyProgramId FK
    int MerchantGroupId FK
    varchar_32 PublicId UK
  }
  GroupLoyaltyProgram {
    int Id PK
    int MerchantGroupId FK
    varchar_32 PublicId UK
  }
  GroupLoyaltyProgramMerchant {
    int Id PK
    int GroupLoyaltyProgramId FK
    int MerchantId FK
  }
  GroupLoyaltyTransaction {
    bigint Id PK
    bigint GroupLoyaltyAccountId FK
    int SourceMerchantId FK
  }
  GroupLoyaltyProgram ||--o{ GroupLoyaltyAccount : "GroupLoyaltyProgramId"
  GroupLoyaltyProgram ||--o{ GroupLoyaltyProgramMerchant : "GroupLoyaltyProgramId"
  GroupLoyaltyAccount ||--o{ GroupLoyaltyTransaction : "GroupLoyaltyAccountId"

Modules & Features

Which platform modules and feature flags each merchant has switched on.

erDiagram
  MerchantFeatureFlag {
    int Id PK
    int MerchantId FK
  }
  MerchantModule {
    int Id PK
    int MerchantId FK
    int ModuleDefinitionId FK
  }
  ModuleDefinition {
    int Id PK
    varchar_50 Code UK
    varchar_32 PublicId UK
  }
  ModuleDefinition ||--o{ MerchantModule : "ModuleDefinitionId"

Notifications

Email/SMS templates and the outbox and delivery-event trail for messages sent.

erDiagram
  EmailEvent {
    bigint Id PK
    bigint OutboxId FK
  }
  EmailOutbox {
    bigint Id PK
    uniqueidentifier IdempotencyKey UK
  }
  NotificationTemplate {
    int Id PK
    varchar_32 PublicId UK
  }
  NotificationTemplateVersion {
    int Id PK
    int TemplateId FK
  }
  EmailOutbox |o--o{ EmailEvent : "OutboxId"
  NotificationTemplate ||--o{ NotificationTemplateVersion : "TemplateId"

Partners & Merchants

Channel partners, the merchants they onboard, and the databases those merchants live in.

erDiagram
  Database {
    int Id PK
    int DatabaseServerId FK
  }
  DatabaseServer {
    int Id PK
    varchar_32 PublicId UK
  }
  Merchant {
    int Id PK
    int MerchantGroupId FK
    int PartnerId FK
    varchar_20 Code UK
    varchar_32 PublicId UK
  }
  MerchantDatabase {
    int Id PK
    int DatabaseId FK
    int MerchantId FK, UK
    varchar_32 PublicId UK
  }
  MerchantGroup {
    int Id PK
    varchar_20 GroupCode UK
    varchar_32 PublicId UK
  }
  Partner {
    int Id PK
    varchar_50 Code UK
    varchar_32 PublicId UK
  }
  PartnerUser {
    int Id PK
    int PartnerId FK
    nvarchar_450 UserId FK, UK
  }
  DatabaseServer ||--o{ Database : "DatabaseServerId"
  MerchantGroup |o--o{ Merchant : "MerchantGroupId"
  Partner ||--o{ Merchant : "PartnerId"
  Database ||--o{ MerchantDatabase : "DatabaseId"
  Merchant ||--o{ MerchantDatabase : "MerchantId"
  Partner ||--o{ PartnerUser : "PartnerId"

Merchant Database

Accounts Receivable

House/charge accounts, their ledgers, and generated statements.

erDiagram
  Account {
    bigint Id PK
    bigint AccountGroupId FK
    varchar_30 AccountNumber UK
    uniqueidentifier GlobalId UK
    varchar_32 PublicId UK
  }
  AccountContact {
    bigint Id PK
    bigint AccountId FK
    bigint CustomerId FK
    uniqueidentifier GlobalId UK
  }
  AccountGroup {
    bigint Id PK
    varchar_20 Code UK
    uniqueidentifier GlobalId UK
    varchar_32 PublicId UK
  }
  AccountLedger {
    bigint Id PK
    bigint AccountId FK
    bigint CustomerId FK
    bigint OrderId FK
    bigint PaymentMethodId FK
    bigint ReasonCodeId FK
    bigint SaleId FK
    uniqueidentifier GlobalId UK
    varchar_32 PublicId UK
  }
  AccountLedgerDetail {
    bigint Id PK
    bigint AccountId FK
    bigint AccountLedgerId FK
    bigint AppliedToDetailId FK
    uniqueidentifier GlobalId UK
  }
  AccountStatement {
    bigint Id PK
    bigint AccountId FK
    bigint GeneratedByEmployeeId FK
    uniqueidentifier GlobalId UK
    varchar_32 PublicId UK
  }
  AccountGroup ||--o{ Account : "AccountGroupId"
  Account ||--o{ AccountContact : "AccountId"
  Account ||--o{ AccountLedger : "AccountId"
  Account ||--o{ AccountLedgerDetail : "AccountId"
  AccountLedger ||--o{ AccountLedgerDetail : "AccountLedgerId"
  AccountLedgerDetail |o--o{ AccountLedgerDetail : "AppliedToDetailId"
  Account ||--o{ AccountStatement : "AccountId"

Audit

Change/action audit trail.

erDiagram
  AuditEntry {
    bigint Id PK
    uniqueidentifier GlobalId UK
  }

Customers & Loyalty

Customers, their loyalty balances, gift cards, coupons, and promotions.

erDiagram
  Coupon {
    bigint Id PK
    bigint PromotionId FK
    varchar_50 Code UK
    uniqueidentifier GlobalId UK
    varchar_32 PublicId UK
  }
  Customer {
    bigint Id PK
    bigint PriceTierId FK
    bigint TaxProfileId FK
    varchar_50 AccountNumber UK
    uniqueidentifier GlobalId UK
    varchar_32 PublicId UK
  }
  CustomerAddress {
    bigint Id PK
    bigint CustomerId FK
    uniqueidentifier GlobalId UK
    varchar_32 PublicId UK
  }
  CustomerStats {
    bigint Id PK
    bigint CustomerId FK, UK
    uniqueidentifier GlobalId UK
  }
  GiftCard {
    bigint Id PK
    bigint ProductId FK
    varchar_25 CardNumber UK
    uniqueidentifier GlobalId UK
    varchar_32 PublicId UK
  }
  GiftCardActivity {
    bigint Id PK
    bigint GiftCardId FK
    bigint SaleId FK
    uniqueidentifier GlobalId UK
  }
  LoyaltyAccount {
    bigint Id PK
    bigint CustomerId FK
    bigint LoyaltyProgramId FK
    uniqueidentifier GlobalId UK
    varchar_32 PublicId UK
  }
  LoyaltyProgram {
    bigint Id PK
    uniqueidentifier GlobalId UK
    varchar_32 PublicId UK
  }
  LoyaltyTransaction {
    bigint Id PK
    bigint LoyaltyAccountId FK
    bigint SaleId FK
    uniqueidentifier GlobalId UK
  }
  Promotion {
    bigint Id PK
    uniqueidentifier GlobalId UK
    varchar_32 PublicId UK
  }
  PromotionRule {
    bigint Id PK
    bigint PromotionId FK
    uniqueidentifier GlobalId UK
  }
  Promotion ||--o{ Coupon : "PromotionId"
  Customer ||--o{ CustomerAddress : "CustomerId"
  Customer ||--o{ CustomerStats : "CustomerId"
  GiftCard ||--o{ GiftCardActivity : "GiftCardId"
  Customer ||--o{ LoyaltyAccount : "CustomerId"
  LoyaltyProgram ||--o{ LoyaltyAccount : "LoyaltyProgramId"
  LoyaltyAccount ||--o{ LoyaltyTransaction : "LoyaltyAccountId"
  Promotion ||--o{ PromotionRule : "PromotionId"

Employees & Time

Employees, their roles and PINs, and clock-in/clock-out time records.

erDiagram
  Employee {
    bigint Id PK
    varchar_50 EmployeeCode UK
    uniqueidentifier GlobalId UK
    varbinary_64 PinEncrypted UK
    varchar_32 PublicId UK
  }
  EmployeeRole {
    bigint Id PK
    bigint EmployeeId FK
    bigint LocationId FK
    uniqueidentifier GlobalId UK
  }
  JobRole {
    bigint Id PK
    bigint EmployeeId FK
    bigint LocationId FK
    uniqueidentifier GlobalId UK
  }
  TimeBreak {
    bigint Id PK
    bigint TimeEntryId FK
    uniqueidentifier GlobalId UK
  }
  TimeEntry {
    bigint Id PK
    bigint EmployeeId FK
    bigint JobRoleId FK
    bigint LocationId FK
    uniqueidentifier GlobalId UK
    varchar_32 PublicId UK
  }
  Employee ||--o{ EmployeeRole : "EmployeeId"
  Employee ||--o{ JobRole : "EmployeeId"
  TimeEntry ||--o{ TimeBreak : "TimeEntryId"
  Employee ||--o{ TimeEntry : "EmployeeId"
  JobRole |o--o{ TimeEntry : "JobRoleId"

Inventory & Adjustments

Per-location stock levels, the movement ledger, adjustments, and physical counts.

erDiagram
  InventoryAdjustment {
    bigint Id PK
    bigint ClosedByEmployeeId FK
    bigint EmployeeId FK
    bigint LocationId FK
    bigint ReasonCodeId FK
    varchar_20 DocumentNumber UK
    uniqueidentifier GlobalId UK
    varchar_32 PublicId UK
  }
  InventoryAdjustmentLine {
    bigint Id PK
    bigint InventoryAdjustmentId FK
    bigint ProductVariantId FK
    uniqueidentifier GlobalId UK
    varchar_32 PublicId UK
  }
  InventoryMovement {
    bigint Id PK
    bigint LocationId FK
    bigint ProductVariantId FK
    uniqueidentifier GlobalId UK
  }
  LocationProduct {
    bigint Id PK
    bigint LocationId FK
    bigint ProductVariantId FK
    bigint TaxGroupId FK
    uniqueidentifier GlobalId UK
  }
  StockCount {
    bigint Id PK
    bigint ClosedByEmployeeId FK
    bigint EmployeeId FK
    bigint LocationId FK
    varchar_20 DocumentNumber UK
    uniqueidentifier GlobalId UK
    varchar_32 PublicId UK
  }
  StockCountItem {
    bigint Id PK
    bigint ProductVariantId FK
    bigint StockCountId FK
    uniqueidentifier GlobalId UK
    varchar_32 PublicId UK
  }
  InventoryAdjustment ||--o{ InventoryAdjustmentLine : "InventoryAdjustmentId"
  StockCount ||--o{ StockCountItem : "StockCountId"

Labels & Printing

Label stock sizes, printable label templates, and the print jobs that run them.

erDiagram
  LabelSize {
    bigint Id PK
    uniqueidentifier GlobalId UK
    nvarchar_100 Name UK
  }
  LabelTemplate {
    bigint Id PK
    bigint LabelSizeId FK
    uniqueidentifier GlobalId UK
    nvarchar_100 Name UK
    varchar_32 PublicId UK
  }
  PrintJob {
    bigint Id PK
    bigint LabelTemplateId FK
    bigint LocationId FK
    uniqueidentifier GlobalId UK
  }
  LabelSize ||--o{ LabelTemplate : "LabelSizeId"
  LabelTemplate ||--o{ PrintJob : "LabelTemplateId"

Locations, Terminals & Settings

Stores, terminals, location groups, and their key/value settings.

erDiagram
  Location {
    bigint Id PK
    bigint DefaultCurrencyId FK
    bigint DefaultTaxGroupId FK
    bigint InitializedFromLocationId FK
    uniqueidentifier GlobalId UK
    varchar_32 PublicId UK
  }
  LocationGroup {
    bigint Id PK
    uniqueidentifier GlobalId UK
    nvarchar_100 Name UK
    varchar_32 PublicId UK
  }
  LocationGroupMember {
    bigint Id PK
    bigint LocationGroupId FK
    bigint LocationId FK
  }
  LocationSetting {
    bigint Id PK
    bigint LocationId FK
  }
  MerchantSetting {
    bigint Id PK
    varchar_100 SettingKey UK
  }
  SettingChangeLog {
    bigint Id PK
  }
  Terminal {
    bigint Id PK
    bigint LocationId FK
    uniqueidentifier GlobalId UK
    varchar_32 PublicId UK
  }
  TerminalSetting {
    bigint Id PK
    bigint TerminalId FK
  }
  Location |o--o{ Location : "InitializedFromLocationId"
  LocationGroup ||--o{ LocationGroupMember : "LocationGroupId"
  Location ||--o{ LocationGroupMember : "LocationId"
  Location ||--o{ LocationSetting : "LocationId"
  Location ||--o{ Terminal : "LocationId"
  Terminal ||--o{ TerminalSetting : "TerminalId"

Orders & Quotes

Quotes, orders, and layaways that can convert into a sale.

erDiagram
  Order {
    bigint Id PK
    bigint ConvertedSaleId FK
    bigint CustomerId FK
    bigint LocationId FK
    uniqueidentifier GlobalId UK
    varchar_50 OrderNumber UK
    varchar_32 PublicId UK
  }
  OrderHistory {
    bigint Id PK
    bigint OrderId FK
    uniqueidentifier GlobalId UK
  }
  OrderLineItem {
    bigint Id PK
    bigint OrderId FK
    bigint ProductVariantId FK
    uniqueidentifier GlobalId UK
    varchar_32 PublicId UK
  }
  OrderPayment {
    bigint Id PK
    bigint OrderId FK
    bigint PaymentMethodId FK
    uniqueidentifier GlobalId UK
  }
  Order ||--o{ OrderHistory : "OrderId"
  Order ||--o{ OrderLineItem : "OrderId"
  Order ||--o{ OrderPayment : "OrderId"

Pricing, Barcodes & Cost

Barcodes, price tiers, price-change documents, and cost-change history for variants.

erDiagram
  CostChange {
    bigint Id PK
    bigint ProductVariantId FK
    bigint SupplierId FK
    uniqueidentifier GlobalId UK
  }
  PriceChange {
    bigint Id PK
    varchar_20 DocumentNumber UK
    uniqueidentifier GlobalId UK
    varchar_32 PublicId UK
  }
  PriceChangeLine {
    bigint Id PK
    bigint PriceChangeId FK
    bigint ProductVariantId FK
    uniqueidentifier GlobalId UK
    varchar_32 PublicId UK
  }
  PriceChangeLocation {
    bigint Id PK
    bigint LocationId FK
    bigint PriceChangeId FK
    uniqueidentifier GlobalId UK
  }
  PriceTier {
    bigint Id PK
    varchar_20 Code UK
    uniqueidentifier GlobalId UK
    varchar_32 PublicId UK
  }
  ProductBarcode {
    bigint Id PK
    bigint ProductVariantId FK
    varchar_50 Barcode UK
    uniqueidentifier GlobalId UK
    varchar_32 PublicId UK
  }
  ProductPrice {
    bigint Id PK
    bigint PriceTierId FK
    bigint ProductVariantId FK
    uniqueidentifier GlobalId UK
  }
  PriceChange ||--o{ PriceChangeLine : "PriceChangeId"
  PriceChange ||--o{ PriceChangeLocation : "PriceChangeId"
  PriceTier ||--o{ ProductPrice : "PriceTierId"

Product & Catalog

The product master, its variants, options, images, categories, and kits.

erDiagram
  Category {
    bigint Id PK
    bigint ParentCategoryId FK
    uniqueidentifier GlobalId UK
    varchar_32 PublicId UK
  }
  KitComponent {
    bigint Id PK
    bigint ComponentProductVariantId FK
    bigint ProductId FK
    uniqueidentifier GlobalId UK
  }
  Product {
    bigint Id PK
    bigint CategoryId FK
    bigint SellingUoMId FK
    bigint StockingUoMId FK
    bigint TagAlongProductId FK
    bigint TaxGroupId FK
    uniqueidentifier GlobalId UK
    varchar_32 PublicId UK
  }
  ProductAlert {
    bigint Id PK
    bigint ProductId FK
    uniqueidentifier GlobalId UK
    varchar_32 PublicId UK
  }
  ProductCategory {
    bigint ProductId PK
    bigint CategoryId PK
  }
  ProductImage {
    bigint Id PK
    bigint ProductId FK, UK
    uniqueidentifier GlobalId UK
    varchar_32 PublicId UK
    char_32 PublicToken UK
  }
  ProductOption {
    bigint Id PK
    bigint ProductId FK
    uniqueidentifier GlobalId UK
  }
  ProductOptionValue {
    bigint Id PK
    bigint ProductOptionId FK
    uniqueidentifier GlobalId UK
  }
  ProductSaleWindow {
    bigint Id PK
    bigint ProductId FK
    uniqueidentifier GlobalId UK
  }
  ProductVariant {
    bigint Id PK
    bigint ProductId FK
    varchar_50 Barcode UK
    uniqueidentifier GlobalId UK
    varchar_32 PublicId UK
    varchar_50 Sku UK
  }
  ProductVariantOptionValue {
    bigint Id PK
    bigint ProductOptionValueId FK
    bigint ProductVariantId FK
    uniqueidentifier GlobalId UK
  }
  ProductWebListing {
    bigint Id PK
    bigint ProductId FK, UK
    uniqueidentifier GlobalId UK
    varchar_200 Slug UK
  }
  Category |o--o{ Category : "ParentCategoryId"
  ProductVariant ||--o{ KitComponent : "ComponentProductVariantId"
  Product ||--o{ KitComponent : "ProductId"
  Category |o--o{ Product : "CategoryId"
  Product |o--o{ Product : "TagAlongProductId"
  Product ||--o{ ProductAlert : "ProductId"
  Category ||--o{ ProductCategory : "CategoryId"
  Product ||--o{ ProductCategory : "ProductId"
  Product ||--o{ ProductImage : "ProductId"
  Product ||--o{ ProductOption : "ProductId"
  ProductOption ||--o{ ProductOptionValue : "ProductOptionId"
  Product ||--o{ ProductSaleWindow : "ProductId"
  Product ||--o{ ProductVariant : "ProductId"
  ProductOptionValue ||--o{ ProductVariantOptionValue : "ProductOptionValueId"
  ProductVariant ||--o{ ProductVariantOptionValue : "ProductVariantId"
  Product ||--o{ ProductWebListing : "ProductId"

Purchasing, Suppliers & Receiving

Suppliers, purchase orders, goods receipts, and distribution to locations.

erDiagram
  Distribution {
    bigint Id PK
    bigint PurchaseReceiptId FK
    bigint SourceLocationId FK
    varchar_20 DocumentNumber UK
    uniqueidentifier GlobalId UK
    varchar_32 PublicId UK
  }
  DistributionAllocation {
    bigint Id PK
    bigint DistributionLineId FK
    bigint LocationId FK
    uniqueidentifier GlobalId UK
  }
  DistributionLine {
    bigint Id PK
    bigint DistributionId FK
    bigint ProductVariantId FK
    bigint PurchaseReceiptLineId FK
    uniqueidentifier GlobalId UK
    varchar_32 PublicId UK
  }
  ProductSupplier {
    bigint Id PK
    bigint ProductId FK, UK
    bigint PurchasingUoMId FK
    bigint SupplierId FK
    uniqueidentifier GlobalId UK
  }
  PurchaseOrder {
    bigint Id PK
    bigint LocationId FK
    bigint SupplierId FK
    varchar_20 DocumentNumber UK
    uniqueidentifier GlobalId UK
    varchar_32 PublicId UK
  }
  PurchaseOrderLine {
    bigint Id PK
    bigint ProductVariantId FK
    bigint PurchaseOrderId FK
    bigint PurchasingUoMId FK
    uniqueidentifier GlobalId UK
    varchar_32 PublicId UK
  }
  PurchaseReceipt {
    bigint Id PK
    bigint LocationId FK
    bigint PurchaseOrderId FK, UK
    bigint SupplierId FK
    varchar_20 DocumentNumber UK
    uniqueidentifier GlobalId UK
    varchar_32 PublicId UK
  }
  PurchaseReceiptLine {
    bigint Id PK
    bigint ProductVariantId FK
    bigint PurchaseOrderLineId FK
    bigint PurchaseReceiptId FK
    bigint PurchasingUoMId FK
    uniqueidentifier GlobalId UK
    varchar_32 PublicId UK
  }
  Supplier {
    bigint Id PK
    uniqueidentifier GlobalId UK
    varchar_32 PublicId UK
  }
  SupplierContact {
    bigint Id PK
    bigint SupplierId FK, UK
    uniqueidentifier GlobalId UK
    varchar_32 PublicId UK
  }
  PurchaseReceipt ||--o{ Distribution : "PurchaseReceiptId"
  DistributionLine ||--o{ DistributionAllocation : "DistributionLineId"
  Distribution ||--o{ DistributionLine : "DistributionId"
  PurchaseReceiptLine |o--o{ DistributionLine : "PurchaseReceiptLineId"
  Supplier ||--o{ ProductSupplier : "SupplierId"
  Supplier ||--o{ PurchaseOrder : "SupplierId"
  PurchaseOrder ||--o{ PurchaseOrderLine : "PurchaseOrderId"
  PurchaseOrder |o--o{ PurchaseReceipt : "PurchaseOrderId"
  Supplier ||--o{ PurchaseReceipt : "SupplierId"
  PurchaseOrderLine |o--o{ PurchaseReceiptLine : "PurchaseOrderLineId"
  PurchaseReceipt ||--o{ PurchaseReceiptLine : "PurchaseReceiptId"
  Supplier ||--o{ SupplierContact : "SupplierId"

Reference / Lookup

Shared lookups — currencies, units, reason codes, sequences, and custom-field defs.

erDiagram
  Currency {
    bigint Id PK
    varchar_3 CurrencyCode UK
    uniqueidentifier GlobalId UK
    varchar_32 PublicId UK
  }
  CustomFieldDefinition {
    bigint Id PK
    uniqueidentifier GlobalId UK
    varchar_32 PublicId UK
  }
  DocumentSequence {
    int Id PK
    varchar_20 DocumentType UK
  }
  ExchangeRate {
    bigint Id PK
    bigint FromCurrencyId FK
    bigint ToCurrencyId FK
    uniqueidentifier GlobalId UK
  }
  ReasonCode {
    bigint Id PK
    varchar_30 Code UK
    uniqueidentifier GlobalId UK
  }
  ReportPin {
    bigint Id PK
    uniqueidentifier GlobalId UK
    varchar_32 PublicId UK
  }
  UnitOfMeasure {
    bigint Id PK
    varchar_10 Code UK
    uniqueidentifier GlobalId UK
  }
  UnitOfMeasureConversion {
    bigint Id PK
    bigint FromUoMId FK
    bigint ToUoMId FK
    uniqueidentifier GlobalId UK
  }
  Currency ||--o{ ExchangeRate : "FromCurrencyId"
  Currency ||--o{ ExchangeRate : "ToCurrencyId"
  UnitOfMeasure ||--o{ UnitOfMeasureConversion : "FromUoMId"
  UnitOfMeasure ||--o{ UnitOfMeasureConversion : "ToUoMId"

Sales & Transactions

Completed POS sales and returns with their lines, payments, taxes, and rollups.

erDiagram
  DailySales {
    bigint Id PK
    bigint LocationId FK
    uniqueidentifier GlobalId UK
  }
  PaymentMethod {
    bigint Id PK
    varchar_30 Code UK
    uniqueidentifier GlobalId UK
  }
  ReturnTracking {
    bigint Id PK
    bigint OriginalSaleLineItemId FK
    bigint ReturnLocationId FK
    bigint ReturnSaleLineItemId FK
    uniqueidentifier GlobalId UK
    varchar_32 PublicId UK
  }
  Sale {
    bigint Id PK
    bigint CurrencyId FK
    bigint CustomerId FK
    bigint LocationId FK
    bigint OriginalSaleId FK
    bigint ShiftId FK
    bigint TerminalId FK
    uniqueidentifier GlobalId UK
    varchar_32 PublicId UK
    varchar_50 SaleNumber UK
  }
  SaleLineItem {
    bigint Id PK
    bigint ProductVariantId FK
    bigint SaleId FK
    bigint TagAlongFromLineId FK
    bigint TaxHolidayId FK
    bigint TaxOverrideReasonCodeId FK
    uniqueidentifier GlobalId UK
  }
  SalePayment {
    bigint Id PK
    bigint PaymentMethodId FK
    bigint SaleId FK
    uniqueidentifier GlobalId UK
  }
  SaleTax {
    bigint Id PK
    bigint SaleId FK
    bigint SaleLineItemId FK
    bigint TaxRateId FK
    uniqueidentifier GlobalId UK
  }
  SaleLineItem ||--o{ ReturnTracking : "OriginalSaleLineItemId"
  SaleLineItem ||--o{ ReturnTracking : "ReturnSaleLineItemId"
  Sale |o--o{ Sale : "OriginalSaleId"
  Sale ||--o{ SaleLineItem : "SaleId"
  SaleLineItem |o--o{ SaleLineItem : "TagAlongFromLineId"
  PaymentMethod ||--o{ SalePayment : "PaymentMethodId"
  Sale ||--o{ SalePayment : "SaleId"
  Sale ||--o{ SaleTax : "SaleId"
  SaleLineItem |o--o{ SaleTax : "SaleLineItemId"

Shifts, Cash & Reconciliation

Cashier shifts, cash movements, and the counts that reconcile the drawer.

erDiagram
  CashMovement {
    bigint Id PK
    bigint ShiftId FK
    bigint ShiftSegmentId FK
    uniqueidentifier GlobalId UK
  }
  NonSaleEvent {
    bigint Id PK
    bigint ShiftId FK
    uniqueidentifier GlobalId UK
    varchar_32 PublicId UK
  }
  Shift {
    bigint Id PK
    bigint ClosedByEmployeeId FK
    bigint CurrentTerminalId FK
    bigint EmployeeId FK
    bigint LocationId FK
    bigint MergedIntoShiftId FK
    uniqueidentifier GlobalId UK
    varchar_32 PublicId UK
    varchar_50 ShiftNumber UK
  }
  ShiftCount {
    bigint Id PK
    bigint PaymentMethodId FK
    bigint ShiftId FK
    uniqueidentifier GlobalId UK
  }
  ShiftSegment {
    bigint Id PK
    bigint ShiftId FK
    bigint TerminalId FK
    uniqueidentifier GlobalId UK
    varchar_32 PublicId UK
  }
  ShiftTaxTotal {
    bigint Id PK
    bigint ShiftId FK
    bigint TaxRateId FK
    uniqueidentifier GlobalId UK
  }
  Shift ||--o{ CashMovement : "ShiftId"
  ShiftSegment |o--o{ CashMovement : "ShiftSegmentId"
  Shift ||--o{ NonSaleEvent : "ShiftId"
  Shift |o--o{ Shift : "MergedIntoShiftId"
  Shift ||--o{ ShiftCount : "ShiftId"
  Shift ||--o{ ShiftSegment : "ShiftId"
  Shift ||--o{ ShiftTaxTotal : "ShiftId"

Sync

Per-device offline sync state, queued device commands, and sync session logs.

erDiagram
  DeviceSyncState {
    bigint Id PK
    uniqueidentifier GlobalId UK
  }
  SyncCommand {
    bigint Id PK
    uniqueidentifier GlobalId UK
  }
  SyncLog {
    bigint Id PK
    uniqueidentifier GlobalId UK
  }

Tax Engine

Tax rates, groups, holidays, and customer tax profiles that drive tax calculation.

erDiagram
  CustomerTaxProfile {
    bigint Id PK
    uniqueidentifier GlobalId UK
    nvarchar_100 Name UK
    varchar_32 PublicId UK
  }
  CustomerTaxProfileMap {
    bigint Id PK
    bigint FromTaxGroupId FK
    bigint TaxProfileId FK
    bigint ToTaxGroupId FK
    uniqueidentifier GlobalId UK
  }
  TaxGroup {
    bigint Id PK
    uniqueidentifier GlobalId UK
    nvarchar_100 Name UK
    varchar_32 PublicId UK
  }
  TaxGroupRate {
    bigint Id PK
    bigint TaxGroupId FK
    bigint TaxRateId FK
    uniqueidentifier GlobalId UK
  }
  TaxHoliday {
    bigint Id PK
    bigint ToTaxGroupId FK
    varchar_50 Code UK
    uniqueidentifier GlobalId UK
    varchar_32 PublicId UK
  }
  TaxHolidayCategory {
    bigint Id PK
    bigint CategoryId FK
    bigint TaxHolidayId FK
    uniqueidentifier GlobalId UK
  }
  TaxHolidayLocation {
    bigint Id PK
    bigint LocationId FK
    bigint TaxHolidayId FK
    uniqueidentifier GlobalId UK
  }
  TaxHolidayProduct {
    bigint Id PK
    bigint ProductId FK
    bigint TaxHolidayId FK
    uniqueidentifier GlobalId UK
  }
  TaxRate {
    bigint Id PK
    varchar_50 Code UK
    uniqueidentifier GlobalId UK
    varchar_32 PublicId UK
  }
  TaxGroup |o--o{ CustomerTaxProfileMap : "FromTaxGroupId"
  CustomerTaxProfile ||--o{ CustomerTaxProfileMap : "TaxProfileId"
  TaxGroup ||--o{ CustomerTaxProfileMap : "ToTaxGroupId"
  TaxGroup ||--o{ TaxGroupRate : "TaxGroupId"
  TaxRate ||--o{ TaxGroupRate : "TaxRateId"
  TaxGroup ||--o{ TaxHoliday : "ToTaxGroupId"
  TaxHoliday ||--o{ TaxHolidayCategory : "TaxHolidayId"
  TaxHoliday ||--o{ TaxHolidayLocation : "TaxHolidayId"
  TaxHoliday ||--o{ TaxHolidayProduct : "TaxHolidayId"

Transfers

Inter-location stock transfer documents and their ship/receive confirmations.

erDiagram
  TransferConfirmation {
    bigint Id PK
    bigint LocationId FK
    bigint TransferOrderId FK
    nvarchar_20 DocumentNumber UK
    uniqueidentifier GlobalId UK
    varchar_32 PublicId UK
  }
  TransferConfirmationLine {
    bigint Id PK
    bigint TransferConfirmationId FK
    bigint TransferOrderLineId FK
    uniqueidentifier GlobalId UK
    varchar_32 PublicId UK
  }
  TransferOrder {
    bigint Id PK
    bigint FromLocationId FK
    bigint ToLocationId FK
    varchar_20 DocumentNumber UK
    uniqueidentifier GlobalId UK
    varchar_32 PublicId UK
  }
  TransferOrderLine {
    bigint Id PK
    bigint ProductVariantId FK
    bigint TransferOrderId FK
    uniqueidentifier GlobalId UK
    varchar_32 PublicId UK
  }
  TransferOrder ||--o{ TransferConfirmation : "TransferOrderId"
  TransferConfirmation ||--o{ TransferConfirmationLine : "TransferConfirmationId"
  TransferOrderLine ||--o{ TransferConfirmationLine : "TransferOrderLineId"
  TransferOrder ||--o{ TransferOrderLine : "TransferOrderId"
No sections match the current search and filters.