Skip to content

feat: add SQL-based cold storage backend#18

Merged
prestwich merged 3 commits intomainfrom
feat/cold-sql-backend
Feb 12, 2026
Merged

feat: add SQL-based cold storage backend#18
prestwich merged 3 commits intomainfrom
feat/cold-sql-backend

Conversation

@prestwich
Copy link
Member

@prestwich prestwich commented Feb 11, 2026

Summary

  • Adds signet-cold-sql crate with SQL-based ColdStorage implementations
  • Unified SqlColdBackend using sqlx::Any supports both PostgreSQL and SQLite from a single implementation
  • Database type auto-detected from connection URL (sqlite: or postgres:)
  • All data stored in fully decomposed SQL columns for rich queryability
  • Docker-based PostgreSQL test infrastructure with docker-compose.yml and scripts/test-postgres.sh
  • Conformance tests pass against both SQLite (in-memory) and PostgreSQL (via Docker)

API

// SQLite
let backend = SqlColdBackend::connect("sqlite::memory:").await?;

// PostgreSQL
let backend = SqlColdBackend::connect("postgres://localhost/signet").await?;

Type aliases SqliteColdBackend and PostgresColdBackend are provided for backward compatibility.

Test plan

  • cargo t -p signet-cold-sql --features test-utils — SQLite conformance passes
  • ./scripts/test-postgres.sh — PostgreSQL conformance passes via Docker
  • cargo clippy --all-features and --no-default-features — clean
  • cargo +nightly fmt — clean

🤖 Generated with Claude Code

Add signet-cold-sql crate implementing ColdStorage trait with fully
decomposed SQL columns for rich queryability. Includes both PostgreSQL
(production) and SQLite (testing/lightweight) backends, Docker-based
test infrastructure, and conformance test coverage for both.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@prestwich prestwich force-pushed the feat/cold-sql-backend branch from 662b37e to 1c4f9fe Compare February 12, 2026 00:38
Replace separate PostgreSQL and SQLite implementations (~1670 lines of
near-duplicate code) with a single SqlColdBackend using sqlx::Any.
The database type is auto-detected from the connection URL.

- Add sqlx/any feature to both backend feature flags
- Unify boolean columns to INTEGER in both migrations for Any driver compat
- Add SqlColdBackend::connect(url) and SqlColdBackend::new(AnyPool)
- Keep SqliteColdBackend/PostgresColdBackend as type aliases

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@prestwich prestwich force-pushed the feat/cold-sql-backend branch from 1c4f9fe to 9093384 Compare February 12, 2026 00:41
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@prestwich prestwich merged commit 43c0928 into main Feb 12, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant