Billing schema
TemplatesERD
Customers, subscriptions and invoices with keys and one-to-many relations.
What is inside
- 3 tables
- Primary and foreign keys
- Money as numeric(12,2)
Use this template
Opens in the playground, no account needed. Sign up to save it.
Show the Inkline text
diagram erd "Billing schema"
table customers { id uuid pk; email text unique; name text }
table subscriptions {
id uuid pk
customer_id uuid fk
plan text
started_at timestamptz
}
table invoices {
id uuid pk
subscription_id uuid fk
amount numeric(12,2)
currency text
}
customers.id -< subscriptions.customer_id
subscriptions.id -< invoices.subscription_id