Skip to content

Allow PG database backend #5880

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 51 commits into from
Jul 22, 2025
Merged

Allow PG database backend #5880

merged 51 commits into from
Jul 22, 2025

Conversation

durch
Copy link
Contributor

@durch durch commented Jul 3, 2025

Summary

  • Added PostgreSQL database support alongside existing SQLite through Cargo feature flags
  • Implemented runtime query conversion from SQLite ? placeholders to PostgreSQL $1, $2, ... format
  • Single codebase now supports both databases without query duplication

Implementation

  • Created query wrapper functions (query(), query_as(), query_scalar()) that automatically convert placeholders
  • Converted all sqlx macro calls to use the wrapper functions
  • Added type conversions where needed (SQLite i64 → PostgreSQL i32)
  • Feature-gated database-specific SQL syntax (RETURNING clauses, INSERT OR IGNORE vs ON CONFLICT)

This change is Reviewable

Copy link

vercel bot commented Jul 3, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
nym-explorer-v2 ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 22, 2025 1:05pm
nym-next-explorer ❌ Failed (Inspect) Jul 22, 2025 1:05pm
nym-node-status ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 22, 2025 1:05pm
1 Skipped Deployment
Name Status Preview Comments Updated (UTC)
docs-nextra ⬜️ Ignored (Inspect) Visit Preview Jul 22, 2025 1:05pm

@durch durch requested a review from jstuczyn July 4, 2025 06:57
Copy link
Contributor

@dynco-nym dynco-nym left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CI is failing due to clippy, but I couldn't fix it locally because cargo build is failing

@dynco-nym
Copy link
Contributor

great work BTW, looking forward to having this merged!

@durch durch merged commit af9f6e5 into develop Jul 22, 2025
13 of 14 checks passed
@durch durch deleted the drazen/node-status-api-pg branch July 22, 2025 13:25
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