Banking ledger schema
Double-entry ledger — accounts, journal entries with debit/credit lines, daily balances.
Make it your own.
Table accounts {
id uuid [pk]
owner varchar
type varchar [note: 'asset | liability | equity | revenue | expense']
currency char(3)
}
Table journal_entries {
id uuid [pk]
posted_at timestamp
memo varchar
}
Table journal_lines {
id bigserial [pk]
entry_id uuid [ref: > journal_entries.id]
account_id uuid [ref: > accounts.id]
debit_minor bigint
credit_minor bigint
}
Table balances_daily {
account_id uuid [ref: > accounts.id]
day date
closing_minor bigint
indexes {
(account_id, day) [pk]
}
}