Database

PostgreSQL in Abhackus

PostgreSQL is the project's source of truth: users, profiles, accounting flows, approval audit trails, attachment integrity metadata, and operational settings are persisted there transactionally.

What it is and why it matters

  • Reliable relational engine with ACID guarantees for accounting operations.
  • Enables auditable queries and consistent reporting by period and status.
  • Works across active modules (REST API, CLI, TUI, and web).
  • Supports versioned migrations for safe schema evolution.

How it is used in this project

  • Main connectivity via `DATABASE_URL` for REST backend and operations.
  • SQL migrations in `abhackus-dborm/migrations` define and evolve schema.
  • `ops` schema groups operational objects (projects, attachments, notifications, etc.).
  • Approval/rejection events store actor, reason, and UTC timestamp.

Recommended connection pattern

Use generic parameters and keep secrets outside version control.

export PGHOST=127.0.0.1
export PGPORT=5432
export PGUSER=app_user
export PGPASSWORD=app_password
export PGDATABASE=abhackus
export DATABASE_URL="postgres://$PGUSER:$PGPASSWORD@$PGHOST:$PGPORT/$PGDATABASE"

# Apply migrations
make migrate

Why this is relevant for governance

A well-structured relational model provides transparency: critical actions are traceable, reproducible, and verifiable by admins and technical collaborators.