Skip to content

Instantly share code, notes, and snippets.

View v1bh0r's full-sized avatar

Vibhor Mahajan v1bh0r

View GitHub Profile
@v1bh0r
v1bh0r / accounting.sql
Created February 20, 2024 01:57 — forked from 001101/accounting.sql
Basic double-entry bookkeeping system, for PostgreSQL.
CREATE TABLE accounts(
id serial PRIMARY KEY,
name VARCHAR(256) NOT NULL
);
CREATE TABLE entries(
id serial PRIMARY KEY,
description VARCHAR(1024) NOT NULL,
amount NUMERIC(20, 2) NOT NULL CHECK (amount > 0.0),
-- Every entry is a credit to one account...