Skip to content

fix: auto-select database connector based on deploy preset#73

Merged
rsbh merged 1 commit into
mainfrom
fix/db-connector-preset
May 14, 2026
Merged

fix: auto-select database connector based on deploy preset#73
rsbh merged 1 commit into
mainfrom
fix/db-connector-preset

Conversation

@rsbh
Copy link
Copy Markdown
Member

@rsbh rsbh commented May 14, 2026

Summary

Auto-select the Nitro database connector based on the deploy preset instead of hardcoding sqlite.

See Nitro Database Connectors for full list.

Preset Connector
bun bun-sqlite
cloudflare / cloudflare-pages / cloudflare-module cloudflare-d1
Default (node, vercel, etc.) sqlite

Test plan

  • Default dev server uses sqlite connector
  • --preset bun uses bun-sqlite
  • Build passes for all presets

- bun → bun-sqlite
- cloudflare → cloudflare-d1
- default (node/vercel) → sqlite

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@vercel
Copy link
Copy Markdown

vercel Bot commented May 14, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
chronicle Ready Ready Preview, Comment May 14, 2026 10:31am

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 14, 2026

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 8262f5ff-7122-4ecf-991a-baa022602d4c

📥 Commits

Reviewing files that changed from the base of the PR and between 44d6e27 and 1a96796.

📒 Files selected for processing (1)
  • packages/chronicle/src/server/vite-config.ts

📝 Walkthrough

Summary by CodeRabbit

  • Chores
    • Improved server database configuration to automatically select the appropriate connector based on the deployment environment, reducing manual setup requirements across different platforms.

Walkthrough

The PR refactors database connector configuration to support multiple runtime environments. A new getDatabaseConnector helper centralizes preset-based connector selection, replacing a hardcoded sqlite config in the Nitrogen settings. The helper supports bun-sqlite for Bun, cloudflare-d1 for Cloudflare, and sqlite as a fallback.

Changes

Database connector selection helper

Layer / File(s) Summary
Database connector selection helper
packages/chronicle/src/server/vite-config.ts
A new getDatabaseConnector(preset?) helper function switches on preset to return the appropriate database connector (bun-sqlite for Bun, cloudflare-d1 for Cloudflare presets, sqlite as default) with connector-specific options. The Nitrogen config is updated to call this helper instead of using a fixed sqlite configuration.

🎯 2 (Simple) | ⏱️ ~8 minutes

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: auto-selecting the database connector based on deploy preset instead of hardcoding sqlite.
Description check ✅ Passed The description clearly explains the purpose of the changes with a detailed mapping table and test plan directly related to the changeset.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/db-connector-preset

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

ESLint skipped: no ESLint configuration detected in root package.json. To enable, add eslint to devDependencies.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@rsbh rsbh merged commit eef9f1e into main May 14, 2026
4 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.

2 participants