Shopify — Database Diagram
Fit
Focus lines
Dark
SVG
PDF
scroll = zoom · drag = pan · click a table
Shopify — Database Diagram
LEGEND
Area: Identity
Area: Merchant
Area: Tenant
Area: Billing
Reference Tables [Static]
Entity Tables
"Important" Tables
Cross-Reference Tables
Other Tables
users
shops
plans
invoices
plan_addons
subscriptions
other foreign keys
IDENTITY
USERS
STAFF
ADMINS
MERCHANT
PLANS
ADDONS
TENANT
CORE
BILLING
SUBSCRIPTIONS
INVOICES
PAYMENTS
users
id
PK
bigint
not null
uuid
UQ
uuid
not null
email
UQ
varchar(255)
not null
password_hash
varchar(255)
not null
user_sessions
id
PK
bigint
not null
user_id
FK
bigint
not null
shop_id
bigint
not null
token_hash
UQ
varchar(64)
not null
expires_at
timestamp
not null
staff_roles
id
PK
bigint
not null
shop_id
bigint
not null
name
varchar(100)
not null
shop_staff
id
PK
bigint
not null
shop_id
bigint
not null
user_id
FK
bigint
not null
role_id
FK
bigint
staff_type
staff_type
not null
is_owner
boolean
not null
staff_invitations
id
PK
bigint
not null
shop_id
bigint
not null
email
varchar(255)
not null
token_hash
UQ
varchar(64)
not null
expires_at
timestamp
not null
platform_admins
id
PK
bigint
not null
email
UQ
varchar(255)
not null
password_hash
varchar(255)
not null
full_name
varchar(100)
not null
plans
id
PK
bigint
not null
slug
UQ
varchar(100)
not null
name
varchar(100)
not null
is_deprecated
boolean
not null
plan_entitlements
id
PK
bigint
not null
plan_id
FK
bigint
not null
key
varchar(100)
not null
value
varchar(255)
not null
plan_prices
id
PK
bigint
not null
plan_id
FK
bigint
not null
currency
char(3)
not null
monthly_cents
int
not null
annual_cents
int
not null
plan_addons
id
PK
bigint
not null
key
UQ
varchar(100)
not null
name
varchar(100)
not null
plan_addon_prices
id
PK
bigint
not null
plan_addon_id
FK
bigint
not null
currency
char(3)
not null
monthly_cents
int
not null
shops
id
PK
bigint
not null
uuid
UQ
uuid
not null
name
varchar(255)
not null
subdomain
UQ
varchar(100)
not null
status
shop_status
not null
shop_settings
id
PK
bigint
not null
shop_id
FK
bigint
not null
key
varchar(100)
not null
value
text
shop_notes
id
PK
bigint
not null
shop_id
FK
bigint
not null
body
text
not null
created_by
FK
bigint
subscriptions
id
PK
bigint
not null
shop_id
FK
bigint
not null
plan_id
FK
bigint
not null
status
subscription_status
not null
trial_ends_at
timestamp
current_period_ends_at
timestamp
not null
plan_change_histories
id
PK
bigint
not null
shop_id
FK
bigint
not null
from_plan_id
FK
bigint
to_plan_id
FK
bigint
not null
subscription_addons
id
PK
bigint
not null
subscription_id
FK
bigint
not null
plan_addon_id
FK
bigint
not null
quantity
int
not null
invoices
id
PK
bigint
not null
shop_id
FK
bigint
not null
subscription_id
FK
bigint
status
invoice_status
not null
total_cents
int
not null
due_at
date
invoice_line_items
id
PK
bigint
not null
invoice_id
FK
bigint
not null
description
varchar(255)
not null
amount_cents
int
not null
transactions
id
PK
bigint
not null
invoice_id
FK
bigint
not null
amount_cents
int
not null
currency
char(3)
not null
payment_retry_attempts
id
PK
bigint
not null
invoice_id
FK
bigint
not null
attempt_number
int
not null
scheduled_at
timestamp
not null
payment_methods
id
PK
bigint
not null
shop_id
FK
bigint
not null
is_default
boolean
not null
provider
varchar(50)
not null
last4
char(4)
billing_usages
id
PK
bigint
not null
shop_id
FK
bigint
not null
metric
varchar(100)
not null
quantity
bigint
not null
shop_credits
id
PK
bigint
not null
shop_id
FK
bigint
not null
amount_cents
int
not null
balance_after_cents
int
not null