-
Notifications
You must be signed in to change notification settings - Fork 81
chore(database): move to drizzle as first class #670
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
Open
atinux
wants to merge
19
commits into
v1
Choose a base branch
from
v1-drizzle
base: v1
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Deploying playground with
|
Latest commit: |
80a6b2c
|
Status: | ✅ Deploy successful! |
Preview URL: | https://5b76f530.playground-bhb.pages.dev |
Branch Preview URL: | https://v1-drizzle.playground-bhb.pages.dev |
The latest updates on your projects. Learn more about Vercel for GitHub.
|
RihanArfan
reviewed
Oct 21, 2025
Comment on lines
17
to
40
if (driver === 'libsql') { | ||
const { drizzle } = await import('drizzle-orm/libsql') | ||
// @ts-expect-error - @libsql/client is an optional dependency | ||
const { createClient } = await import('@libsql/client') | ||
const client = createClient(connection) | ||
return drizzle(client) | ||
} else if (driver === 'node-postgres') { | ||
const { drizzle } = await import('drizzle-orm/node-postgres') | ||
// @ts-expect-error - pg is an optional dependency | ||
const pg = await import('pg') | ||
const pool = new pg.Pool(connection) | ||
return drizzle(pool) | ||
} else if (driver === 'mysql2') { | ||
const { drizzle } = await import('drizzle-orm/mysql2') | ||
// @ts-expect-error - mysql2 is an optional dependency | ||
const mysql = await import('mysql2/promise') | ||
const pool = mysql.createPool(connection) | ||
return drizzle(pool) | ||
} else if (driver === 'pglite') { | ||
const { drizzle } = await import('drizzle-orm/pglite') | ||
const { PGlite } = await import('@electric-sql/pglite') | ||
const client = new PGlite(connection.dataDir) | ||
return drizzle(client) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We're manually creating the database instances but we just pass them to Drizzle.
I think we should either:
- also return the underlying driver (we need this later for studio via drizzlekit API with passing the pglite instance) or
- let drizzle handle creating the instance itself (except for pglite which we need to save the instance for)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Expose
drizzle()
directly from#hub/database
with proper client setTest with CF D1
Avoid relying on
nitro:init
hook