Skip to content

Add PostgreSQL support for mint and wallet#878

Merged
thesimplekid merged 12 commits intocashubtc:mainfrom
crodas:feature/pg-sql
Aug 18, 2025
Merged

Add PostgreSQL support for mint and wallet#878
thesimplekid merged 12 commits intocashubtc:mainfrom
crodas:feature/pg-sql

Conversation

@crodas
Copy link
Copy Markdown
Collaborator

@crodas crodas commented Jul 8, 2025

Description

This is a WIP branch to add PostgreSQL support, fixing #877.

This PR depends on #890

Approach

  • Introduce cdk-sql-base a generic abstraction on top of any SQL database for the mint and the wallet
    • Rename cdk-sqlite into this crate.
    • Unify the statement.
    • Add a simple placeholder parser, supporting named arguments, but let the database driver to use positional placeholder, in whatever format they need. Make it work with bind and bind_vec.
    • Add custom migration for database vendor name, or migrations that applies to all.
    • Add cache for the placeholder parsed list
  • Make cdk-sqlite use cdk-sql-base
  • Add cdk-postgres

Notes to the reviewers


Suggested CHANGELOG Updates

CHANGED

ADDED

REMOVED

FIXED


Checklist

@crodas crodas force-pushed the feature/pg-sql branch 3 times, most recently from 8651d5e to d7afae5 Compare July 8, 2025 21:56
@crodas crodas self-assigned this Jul 8, 2025
@asmogo asmogo mentioned this pull request Jul 10, 2025
6 tasks
@crodas crodas force-pushed the feature/pg-sql branch 4 times, most recently from d0f150d to 3b8c979 Compare July 15, 2025 08:59
crodas added a commit to crodas/cdk that referenced this pull request Jul 15, 2025
The primary purpose of this new crate is to have a common and shared codebase
for all SQL storage systems. It would force us to write standard SQL using best
practices for all databases.

This crate has been extracted from cashubtc#878
@crodas crodas mentioned this pull request Jul 15, 2025
2 tasks
crodas added a commit to crodas/cdk that referenced this pull request Jul 15, 2025
The primary purpose of this new crate is to have a common and shared codebase
for all SQL storage systems. It would force us to write standard SQL using best
practices for all databases.

This crate has been extracted from cashubtc#878
crodas added a commit to crodas/cdk that referenced this pull request Jul 15, 2025
The primary purpose of this new crate is to have a common and shared codebase
for all SQL storage systems. It would force us to write standard SQL using best
practices for all databases.

This crate has been extracted from cashubtc#878
crodas added a commit to crodas/cdk that referenced this pull request Jul 15, 2025
The primary purpose of this new crate is to have a common and shared codebase
for all SQL storage systems. It would force us to write standard SQL using best
practices for all databases.

This crate has been extracted from cashubtc#878
crodas added a commit to crodas/cdk that referenced this pull request Jul 15, 2025
The primary purpose of this new crate is to have a common and shared codebase
for all SQL storage systems. It would force us to write standard SQL using best
practices for all databases.

This crate has been extracted from cashubtc#878
crodas added a commit to crodas/cdk that referenced this pull request Jul 15, 2025
The primary purpose of this new crate is to have a common and shared codebase
for all SQL storage systems. It would force us to write standard SQL using best
practices for all databases.

This crate has been extracted from cashubtc#878
crodas added a commit to crodas/cdk that referenced this pull request Jul 15, 2025
The primary purpose of this new crate is to have a common and shared codebase
for all SQL storage systems. It would force us to write standard SQL using best
practices for all databases.

This crate has been extracted from cashubtc#878
crodas added a commit to crodas/cdk that referenced this pull request Jul 16, 2025
The primary purpose of this new crate is to have a common and shared codebase
for all SQL storage systems. It would force us to write standard SQL using best
practices for all databases.

This crate has been extracted from cashubtc#878
crodas added a commit to crodas/cdk that referenced this pull request Jul 17, 2025
The primary purpose of this new crate is to have a common and shared codebase
for all SQL storage systems. It would force us to write standard SQL using best
practices for all databases.

This crate has been extracted from cashubtc#878
crodas added a commit to crodas/cdk that referenced this pull request Jul 19, 2025
The primary purpose of this new crate is to have a common and shared codebase
for all SQL storage systems. It would force us to write standard SQL using best
practices for all databases.

This crate has been extracted from cashubtc#878
@crodas crodas force-pushed the feature/pg-sql branch 2 times, most recently from 3b38719 to 881e297 Compare July 20, 2025 19:52
crodas added a commit to crodas/cdk that referenced this pull request Jul 22, 2025
The primary purpose of this new crate is to have a common and shared codebase
for all SQL storage systems. It would force us to write standard SQL using best
practices for all databases.

This crate has been extracted from cashubtc#878
crodas added a commit to crodas/cdk that referenced this pull request Jul 24, 2025
The primary purpose of this new crate is to have a common and shared codebase
for all SQL storage systems. It would force us to write standard SQL using best
practices for all databases.

This crate has been extracted from cashubtc#878
crodas added a commit to crodas/cdk that referenced this pull request Jul 25, 2025
The primary purpose of this new crate is to have a common and shared codebase
for all SQL storage systems. It would force us to write standard SQL using best
practices for all databases.

This crate has been extracted from cashubtc#878
crodas added a commit to crodas/cdk that referenced this pull request Jul 28, 2025
The primary purpose of this new crate is to have a common and shared codebase
for all SQL storage systems. It would force us to write standard SQL using best
practices for all databases.

This crate has been extracted from cashubtc#878
crodas added a commit to crodas/cdk that referenced this pull request Jul 29, 2025
The primary purpose of this new crate is to have a common and shared codebase
for all SQL storage systems. It would force us to write standard SQL using best
practices for all databases.

This crate has been extracted from cashubtc#878
@crodas crodas force-pushed the feature/pg-sql branch 2 times, most recently from 16bfd51 to 52b7902 Compare August 10, 2025 03:57
@thesimplekid
Copy link
Copy Markdown
Collaborator

If we add cargo update -p native-tls --precise 0.2.13 to the msrv shell it seems like the msrv is met.

Comment thread crates/cdk-postgres/src/db.rs Outdated
@thesimplekid
Copy link
Copy Markdown
Collaborator

Can we split 5f9b0b5 into its own pr I want to review that more carefully. Other then that I think it looks pretty good.

@thesimplekid thesimplekid added this to the v0.12 milestone Aug 13, 2025
@crodas crodas marked this pull request as ready for review August 18, 2025 02:06
@crodas crodas requested a review from thesimplekid August 18, 2025 02:07
thesimplekid
thesimplekid previously approved these changes Aug 18, 2025
@thesimplekid
Copy link
Copy Markdown
Collaborator

ACK 2b56063

@asmogo
Copy link
Copy Markdown
Collaborator

asmogo commented Aug 18, 2025

Successfully tested 2b56063 with psql and crdb.

LGTM.

@thesimplekid thesimplekid merged commit 28a0139 into cashubtc:main Aug 18, 2025
88 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.

3 participants