-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Labels
enhancementNew feature or requestNew feature or request
Description
Summary
Add PostgreSQL with pgvector as an alternative database backend to SQLite, enabling multi-user concurrent access and horizontal scaling.
Motivation
SQLite is perfect for personal use but has single-writer limitations. PostgreSQL with pgvector unlocks: concurrent multi-user access, team deployments, cloud-hosted instances, and is required for any SaaS/hosted offering.
Implementation
src/db/postgres.ts— PostgreSQL connection manager usingpg(node-postgres)src/db/backend.ts— Abstract database interface that both SQLite and Postgres implementsrc/db/migrations-pg.ts— PostgreSQL-specific schema migrations (pgvector types, GIN indexes)- Refactor
src/db/schema.tsto be backend-agnostic - Config:
LIBSCOPE_DB_URL=postgresql://...orlibscope config set db.backend postgres
Key Differences from SQLite
- Vector search via pgvector
<->(cosine distance) instead of sqlite-vec - FTS via
tsvector+ts_queryinstead of FTS5 - Connection pooling (pg Pool)
- Proper concurrent transactions
Migration Path
libscope migrate --to postgres --url <pg-url>— migrate existing SQLite data to Postgres- Auto-detect backend from connection string
Acceptance Criteria
- Database interface abstraction (SQLite + Postgres implement same interface)
- Postgres connection manager with pooling
- All schema migrations ported to Postgres/pgvector
- Vector search working with pgvector
- Full-text search working with tsvector
- Migration tool from SQLite → Postgres
- All existing tests pass against both backends
- Integration test suite for Postgres (can use Docker)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request