Billing
fk_rails_3d4e5f6a7b accounts.plan_id → billing.plans.id
fk_rails_e4f5a6b7c8 billing.invoice_line_items.invoice_id → billing.invoices.id ON DELETE CASCADE
fk_rails_c2d3e4f5a6 billing.invoices.account_id → accounts.id
fk_rails_d3e4f5a6b7 billing.invoices.subscription_id → billing.subscriptions.id
fk_rails_f5a6b7c8d9 billing.payments.invoice_id → billing.invoices.id
fk_rails_a0b1c2d3e4 billing.subscriptions.account_id → accounts.id ON DELETE CASCADE
fk_rails_b1c2d3e4f5 billing.subscriptions.plan_id → billing.plans.id
public.accounts A tenant. Everything hangs off an account. 4 of 7 columns hidden
accounts
5 relations to hidden tables
↗5
id bigint NOT NULL primary key default: nextval('public.accounts_id_seq'::regclass)
primary key
PK
id
bigint
slug public.citext NOT NULL unique index index_accounts_on_slug (slug)
unique unique index index_accounts_on_slug (slug)
UQ
slug
citext
plan_id bigint → billing.plans(id) fk_rails_3d4e5f6a7b
foreign key → billing.plans(id) fk_rails_3d4e5f6a7b
FK
plan_id
bigint
nullable
?
… 4 more columns
billing.invoice_line_items 4 of 6 columns hidden
billing.
invoice_line_items
id bigint NOT NULL primary key default: nextval('billing.invoice_line_items_id_seq'::regclass)
primary key
PK
id
bigint
invoice_id bigint NOT NULL → billing.invoices(id) on delete cascade fk_rails_e4f5a6b7c8 index index_invoice_line_items_on_invoice_id (invoice_id)
foreign key → billing.invoices(id) on delete cascade fk_rails_e4f5a6b7c8
FK
in 1 index index index_invoice_line_items_on_invoice_id (invoice_id)
IX
invoice_id
bigint
… 4 more columns
billing.invoices 7 of 11 columns hidden
billing.
invoices
id bigint NOT NULL primary key default: nextval('billing.invoices_id_seq'::regclass)
primary key
PK
id
bigint
account_id bigint NOT NULL → accounts(id) fk_rails_c2d3e4f5a6 index index_invoices_on_account_id (account_id)
foreign key → accounts(id) fk_rails_c2d3e4f5a6
FK
in 1 index index index_invoices_on_account_id (account_id)
IX
account_id
bigint
subscription_id bigint → billing.subscriptions(id) fk_rails_d3e4f5a6b7 index index_invoices_on_subscription_id (subscription_id)
foreign key → billing.subscriptions(id) fk_rails_d3e4f5a6b7
FK
in 1 index index index_invoices_on_subscription_id (subscription_id)
IX
subscription_id
bigint
nullable
?
number character varying NOT NULL unique index index_invoices_on_number (number)
unique unique index index_invoices_on_number (number)
UQ
number
varchar
… 7 more columns
billing.payments 5 of 7 columns hidden
billing.
payments
id bigint NOT NULL primary key default: nextval('billing.payments_id_seq'::regclass)
primary key
PK
id
bigint
invoice_id bigint NOT NULL → billing.invoices(id) fk_rails_f5a6b7c8d9 index index_payments_on_invoice_id (invoice_id)
foreign key → billing.invoices(id) fk_rails_f5a6b7c8d9
FK
in 1 index index index_payments_on_invoice_id (invoice_id)
IX
invoice_id
bigint
… 5 more columns
billing.plans 4 of 6 columns hidden
billing.
plans
id bigint NOT NULL primary key default: nextval('billing.plans_id_seq'::regclass)
primary key
PK
id
bigint
code character varying NOT NULL unique index index_plans_on_code (code)
unique unique index index_plans_on_code (code)
UQ
code
varchar
… 4 more columns
billing.subscriptions 5 of 8 columns hidden
billing.
subscriptions
id bigint NOT NULL primary key default: nextval('billing.subscriptions_id_seq'::regclass)
primary key
PK
id
bigint
account_id bigint NOT NULL → accounts(id) on delete cascade fk_rails_a0b1c2d3e4 index index_subscriptions_on_account_id (account_id)
foreign key → accounts(id) on delete cascade fk_rails_a0b1c2d3e4
FK
in 1 index index index_subscriptions_on_account_id (account_id)
IX
account_id
bigint
plan_id bigint NOT NULL → billing.plans(id) fk_rails_b1c2d3e4f5
foreign key → billing.plans(id) fk_rails_b1c2d3e4f5
FK
plan_id
bigint
… 5 more columns