Visual Schema

A graphical representation of how our data objects connect inside the Endear App.

The diagram below shows how the recurring CSV files relate to one another. Each line connects a foreign-key column on one file to the primary key (id) of the file it references.

erDiagram
  Customers {
    string id PK
  }
  StaffMembers {
    string id PK
  }
  Locations {
    string id PK
  }
  Products {
    string id PK
  }
  ProductVariants {
    string id PK
    string product_id FK
  }
  Purchases {
    string id PK
    string processed_by_user_id FK
    list assisted_by_user_ids FK
    string location_id FK
    string customer_id FK
  }
  PurchaseLineItems {
    string id PK
    string order_id FK
    string product_id FK
    string product_variant_id FK
  }
  Refunds {
    string id PK
    string original_order_id FK
    string original_order_item_id FK
    string product_id FK
    string product_variant_id FK
  }

  Customers ||--o{ Purchases : "customer_id"
  Locations ||--o{ Purchases : "location_id"
  StaffMembers ||--o{ Purchases : "processed_by_user_id"
  StaffMembers }o--o{ Purchases : "assisted_by_user_ids"
  Products ||--o{ ProductVariants : "product_id"
  Products ||--o{ PurchaseLineItems : "product_id"
  ProductVariants ||--o{ PurchaseLineItems : "product_variant_id"
  Purchases ||--o{ PurchaseLineItems : "order_id"
  Purchases ||--o{ Refunds : "original_order_id"
  PurchaseLineItems ||--o{ Refunds : "original_order_item_id"
  Products ||--o{ Refunds : "product_id"
  ProductVariants ||--o{ Refunds : "product_variant_id"

For the full list of columns on each file, see the Schema Reference.