Skip to content

Move core database reads to PostgreSQL with JSON fallback #150

Description

@atomantic

Make PostgreSQL the async query backend for the central database service while retaining the existing JSON source-of-truth fallback when PostgreSQL is missing or unreachable.

Depends on #148
Depends on #149

Scope:

  • Convert server/src/services/database.service.ts and its direct route callers to the asynchronous PostgreSQL query boundary.
  • Replace SQLite-specific availability naming/selection with a backend-neutral or PostgreSQL-specific guard.
  • Preserve the current fallback contract: startup and data endpoints continue serving JSON-backed data when the query store cannot be reached.
  • Cover database listing, root resolution, single/batch person loads, membership reads, generation limits, statistics, and destructive database cleanup.
  • Keep response shapes and route behavior stable.

Acceptance criteria:

  • Core data endpoints return equivalent results from a rebuilt PostgreSQL store.
  • Stopping PostgreSQL before server startup selects JSON fallback without 500s; losing it during a request is handled consistently with the documented guard.
  • All migrated calls are awaited and no Promise leaks into response objects.
  • SQLite remains only for feature services not yet migrated by sibling slices.

Files/areas: server/src/services/database.service.ts, its direct route/service callers, backend selection/health helpers, database service and route tests.

Part of #120

After this issue ships, check its box in #120. If it was the last open child, comment on #120 with a summary of the delivered children and close #120 as completed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    effort:maxMaximum reasoning effort recommendedmodel:heavyBest suited to the strongest available coding modelplanClaimable backlog item

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions