kysely-org / kysely

A type-safe typescript SQL query builder
https://kysely.dev
MIT License
9.9k stars 249 forks source link

Request: CLI migrations tool for Deno #948

Closed Sleepful closed 3 months ago

Sleepful commented 3 months ago

As I read from the docs:

A CLI would cause confusion over which migrations are being run, the TypeScript ones or the JavaScript ones. If we added support for both, the CLI would need to depend on a TypeScript compiler, which most production environments don't (and shouldn't) have.

I was thinking , this would not be a problem with Deno, as Deno does not have this compilation step :)

igalklebanov commented 3 months ago

Hey 👋

Check https://github.com/kysely-org/awesome-kysely/#clis for some community CLIs.

Sleepful commented 3 months ago

@igalklebanov ohey thank you. I might check them later, I am finding it challenging to set-up deno with Kysely and I think the docs are wrong in some parts. For example in the migration docs, the module npm:pg is suggested for Deno (in the sample code for migrations), but this simply doesn't work, it is a Node-only driver.

After some non-trivial amount of searching I found kysely-postgres-js, this actually works with Deno and should be used in the docs instead.

Not sure who updates the docs but that's my 2 cents, it's kind of challenging to use Kysely with Deno based on the docs and it seems that it shouldn't be so, as there are enough pieces to make it work.

igalklebanov commented 3 months ago

For example in the migration docs, the module npm:pg is suggested for Deno (in the sample code for migrations), but this simply doesn't work, it is a Node-only driver.

How do you explain the deno test working with npm:pg and npm:pg-pool? https://github.com/kysely-org/kysely/tree/master/test/deno

Not sure who updates the docs

Careful with that type of language. It may come off as entitled. People update the docs, on their spare time. PRs are always welcome.

Sleepful commented 3 months ago

Careful with that type of language. It may come off as entitled.

Why? I feel like you are tone policing my message. I simply don't know, it is fact.

Sleepful commented 3 months ago

How do you explain the deno test working with npm:pg and npm:pg-pool?

Oh yeah, this simplified example did work on my machine. Thanks. I must have typed something wrong from copying the sample code here:

https://www.kysely.dev/docs/migrations#running-migrations

E.g. Database is not in scope, and the code is geared at NodeJS (deno now supports node:fs for example, which I didn't get working quite right in my machine).

Sleepful commented 3 months ago

😁

igalklebanov commented 3 months ago

We could try making more sections friendly to other runtime environments, like we did with "Getting Started".

Sleepful commented 3 months ago

Nice! I'm working on adding migrations to my Deno project so if it works out I might push an update