Overview
Create the core data models and PostgreSQL database layer for the Ledger Service.
Tasks
Database Schema
CREATE TABLE accounts (
id UUID PRIMARY KEY,
name VARCHAR(100) NOT NULL,
balance DECIMAL(15,2) NOT NULL DEFAULT 0,
created_at TIMESTAMP DEFAULT NOW()
);
CREATE TABLE transactions (
id UUID PRIMARY KEY,
from_account UUID REFERENCES accounts(id),
to_account UUID REFERENCES accounts(id),
amount DECIMAL(15,2) NOT NULL,
description VARCHAR(255),
created_at TIMESTAMP DEFAULT NOW()
);
Testing Requirements
Acceptance Criteria
- Models are well-documented with JSON tags
- All CRUD operations work with PostgreSQL
- X.509 auth works via spiffe-helper certificates
- 90%+ test coverage on database layer
Labels
phase-1 backend database
Overview
Create the core data models and PostgreSQL database layer for the Ledger Service.
Tasks
pkg/ledger/models.gowith Account and Transaction structspkg/ledger/postgres.gowith database operationsdeploy/postgresql/init-trustbank.sqlwith schemaDatabase Schema
Testing Requirements
Acceptance Criteria
Labels
phase-1backenddatabase