-
-
Notifications
You must be signed in to change notification settings - Fork 719
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
[BUG]: No way to use bun:sqlite
together with dirzzle-kit
#1520
Comments
I'm using bun + drizzle-kit. it's very quick to use push:sqlite to change tables in dev environment. Is there any progress here? |
using |
@rifaldhiaw How did you configure it exactly? It tells me |
I also dont know how to use bun:sqlite with Drizzle Kit / Drizzle Studio. This issue is 1,5 years old. I wonder if Drizzle is still in development or where the focus lies? @dankochetov Another related issue (maybe a duplicate) with 10 upvotes: #1795 P.S. The same goes for Vercel and Neon -> Why cant I use this drivers within drizzle.config ? Issue: #1612 |
@dankochetov Will drizzle team fully implement support for Bun SQLite in Drizzle Kit? |
I confirm that drizzle studio does not work with bun:sqlite
|
still an issue haha |
There seems to be some development within Drizzle but I dont feel they look at any Github issues at all. For example I had an open issue which they fixed "by accident" but they didnt close my issue or reacted in any way. |
I found the solution in bunjs docs here just add this: // database/index.ts
import { drizzle } from 'drizzle-orm/bun-sqlite';
import { Database } from 'bun:sqlite';
import { migrate } from 'drizzle-orm/bun-sqlite/migrator';
const sqlite = new Database('sqlite.db');
const db = drizzle(sqlite);
migrate(db, { migrationsFolder: './drizzle' });
export { db }; // drizzle.config.ts
import { defineConfig } from 'drizzle-kit';
export default defineConfig({
dialect: 'sqlite',
schema: './src/lib/server/database/schema.ts',
out: './drizzle',
dbCredentials: {
url: 'file:./sqlite.db'
}
}); run edit: you need to restart your dev server to load the migration 😑 |
|
import { defineConfig } from 'drizzle-kit'
export default defineConfig({
dialect: 'sqlite',
schema: './src/db/schema.ts',
out: './src/db/migrations',
dbCredentials: {
url: './data/db/app.db',
},
verbose: true,
}) Please install either 'better-sqlite3' or '@libsql/client' for Drizzle Kit to connect to SQLite databases |
I get that with |
I think For anyone needing a working configuration, here's mine: // db.ts
import { Database } from 'bun:sqlite';
import { drizzle } from 'drizzle-orm/bun-sqlite';
import * as schema from '@/db/schema';
const sqlite = new Database();
export const db = drizzle(sqlite, { schema }); // drizzle.config.ts
import { defineConfig } from 'drizzle-kit';
export default defineConfig({
dbCredentials: {
url: 'file:path/to/local.db',
},
dialect: 'sqlite',
out: './src/db/migrations',
schema: './src/db/schema.ts',
}); |
Bun natively implements a high-performance SQLite3 driver. And it is already usable with Drizzle. Why should we install another third party sqlite driver just for Drizzle Kit? The issue is marked as a bug but please consider this as a feature request to support both Bun Database and Bun native driver |
I can confirm
|
Also worth noting that even after installing
|
I'll also add that |
I wonder why this seems so challenging to implement. Did anyone took a deeper look and can outline the blockers? |
- Fixes: drizzle-team#1520, drizzle-team#3423 Signed-off-by: minicx <[email protected]>
- Fixes: drizzle-team#1520, drizzle-team#3423 Signed-off-by: minicx <[email protected]>
- Fixes: drizzle-team#1520, drizzle-team#3423 Signed-off-by: minicx <[email protected]>
What version of
drizzle-orm
are you using?v0.29.0
What version of
drizzle-kit
are you using?v0.20.1
Describe the Bug
Ran the following command where
driver
is set tobun:sqlite
:Expected behavior
For this to work when running with
bun drizzle-kit
Environment & setup
No response
The text was updated successfully, but these errors were encountered: