Skip to content

Instantly share code, notes, and snippets.

View locriani's full-sized avatar

Zach Gardner locriani

  • San Francisco, CA
  • 16:15 (UTC -07:00)
View GitHub Profile
@NYKevin
NYKevin / accounting.sql
Last active July 7, 2024 18:12
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...