Multi-user and multi-service base #2

Open
opened 2026-08-07 14:22:39 +00:00 by hum3 · 0 comments
Owner

Overview

Abstract the database layer so multiple gobank services (demo, accounts, workflow, customers) can share one database safely.

Requirements

  • Shared *sql.DB instance passed to each service's store
  • Table namespace isolation per service (prefixed tables)
  • Each service registers its schema migrations independently
  • Migration ordering respects cross-service dependencies
  • UUID v4 primary keys throughout (compatible with CockroachDB)

Current State

gobank demo currently creates its own *sql.DB in initDB() and passes it to go-luca's SQLLedger and gobanks-customers' CustomerStore. This pattern needs to be formalised.

Acceptance Criteria

  • Registry that services register their migrations with
  • Ordered migration execution across services
  • Documented pattern for adding a new service
  • Tests with multiple services sharing one DB

Migrated from Codeberg: originally #2, opened 2026-03-25.

## Overview Abstract the database layer so multiple gobank services (demo, accounts, workflow, customers) can share one database safely. ## Requirements - Shared `*sql.DB` instance passed to each service's store - Table namespace isolation per service (prefixed tables) - Each service registers its schema migrations independently - Migration ordering respects cross-service dependencies - UUID v4 primary keys throughout (compatible with CockroachDB) ## Current State gobank demo currently creates its own `*sql.DB` in `initDB()` and passes it to go-luca's `SQLLedger` and gobanks-customers' `CustomerStore`. This pattern needs to be formalised. ## Acceptance Criteria - `Registry` that services register their migrations with - Ordered migration execution across services - Documented pattern for adding a new service - Tests with multiple services sharing one DB --- *Migrated from Codeberg: originally [#2](https://codeberg.org/hum3/gobank-db/issues/2), opened 2026-03-25.*
Sign in to join this conversation.
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
hum3/gobank-db#2
No description provided.