drizzle-orm icon indicating copy to clipboard operation
drizzle-orm copied to clipboard

[BUG]: Migration runners not working using bun:sqlite

Open jorgeavaldez opened this issue 1 year ago • 8 comments

What version of drizzle-orm are you using?

0.23.5

Describe the Bug

I have this connection file:

import { drizzle } from 'drizzle-orm/bun-sqlite';
import { Database } from 'bun:sqlite';


const sqlite = new Database('test.db');
const db = drizzle(sqlite);

export default db;

and this migration script:

import { migrate } from "drizzle-orm/bun-sqlite/migrator";

import db from "./connection";

migrate(db, { migrationsFolder: "./db/migrations" });

using this drizzle.config.json:

{
  "out": "./db/migrations",
  "schema": "./db/schema.ts"
}

Here's what my directory structure looks like: image

I'm using bun v0.5.9 and SQLite version 3.39.5 on macOS.

When I try bun run db/migrate.ts, I get the following error:

image

It ends up creating test.db along with the initial migrations table. image

jorgeavaldez avatar Apr 05 '23 03:04 jorgeavaldez

Want to chime in that I'm having the same problem.

kansson avatar Apr 27 '23 18:04 kansson

I'm also having this issue.

kognise avatar Apr 29 '23 20:04 kognise

Bump. I'm having the same issue regardless of the schema it errors, defiantly a universal bun.sh bug.

Specs: Windows: WSL Linux Bun Version: 0.6.3

Migration code: image

Error: image

edge-rps avatar May 23 '23 05:05 edge-rps

Same issue here. Bun version: 0.6.6 Drizzle-Orm version: 0.26.3 Screenshot_20230601_185602

johnpgr avatar Jun 01 '23 21:06 johnpgr

Bumping... This is really broken. Are there no unit tests to catch those kind of issues?

mindreframer avatar Jun 05 '23 12:06 mindreframer

Fixed in PR @dankochetov will merge it soon

AndriiSherman avatar Jun 05 '23 12:06 AndriiSherman

@AndriiSherman Thanks! There is another problem with queries that return empty results, I will open another issue

mindreframer avatar Jun 05 '23 12:06 mindreframer

Seems like it was a bun.sh bug https://github.com/drizzle-team/drizzle-orm/pull/631#issuecomment-1577895541

AndriiSherman avatar Jun 06 '23 05:06 AndriiSherman

Should be fixed in bun v0.6.8

AndriiSherman avatar Jun 12 '23 10:06 AndriiSherman