oven-sh / bun

Incredibly fast JavaScript runtime, bundler, test runner, and package manager – all in one
https://bun.sh
Other
73.45k stars 2.7k forks source link

bun drizzle sqlite documentation wrong? #11958

Open fjdvchain opened 3 months ago

fjdvchain commented 3 months ago

What is the type of issue?

Documentation is incorrect

What is the issue?

I don't know if this regressed or if its a bun or drizzle issue. but if you follow this documentation: https://bun-sh.translate.goog/guides/ecosystem/drizzle?_x_tr_sl=en&_x_tr_tl=pt&_x_tr_hl=pt-PT&_x_tr_pto=sc

when you run the query

const query = sql`select "hello world" as text`;
const result = db.get<{ text: string }>(query);
console.log(result);

it produces an output of

[ "hello world" ]

instead of what the docs say which is

{
  text: "hello world"
}

Where did you find it?

https://bun-sh.translate.goog/guides/ecosystem/drizzle?_x_tr_sl=en&_x_tr_tl=pt&_x_tr_hl=pt-PT&_x_tr_pto=sc

fjdvchain commented 3 months ago

Also this is wrong too

bunx drizzle-kit generate:sqlite --schema ./schema.ts

running it on my machine output was

bunx drizzle-kit generate:sqlite --schema ./db/schema.ts
error: unknown option '--schema'
FjellOverflow commented 3 months ago

@fjdvchain You can use instead bunx drizzle-kit generate --dialect sqlite --schema ./schema.ts

fjdvchain commented 3 months ago

Yup that worked fine, thank you @FjellOverflow