Closed anthonyalayo closed 2 years ago
Hello there!
Thanks for the issue.
Honestly, I'm not well-versed enough in SSL to know what the best thing to do here is. For my local Heroku setup, it only works with ssl: { rejectUnauthorized: false }
and no sslmode=disable
, but I want it to work for everyone of course.
In any case, it seems like you successfully did find a workaround, since it apparently did introspect 4 models. The fact that DB is still empty indicates that the file was either written to the wrong place, or not written at all, which I could not replicate on my machine with pnpm or npm.
I just released kysely-codegen@0.1.2
which adds some debugging support:
kysely-codegen --log-level=debug
, which shows all tables it found.kysely-codegen --print
, which shows the generated output (without writing to disk).Aside from that, try specifying a custom --out-file
. Maybe something goes wrong with the path to node_modules
or something.
I think I've fixed the SSL bug in kysely-codegen@0.2.0
. Not the best solution, but it now works for me with:
I can't replicate the file generation bug though, but maybe we can work it out together.
I've tried to pull the latest to give it another shot, but now kysely-codegen seems to hang here?
❯ npm install kysely-codegen took 9s at 11:40:56 AM
(##################) ⠴ reify:better-sqlite3: timing reifyNode:node_modules/kysely-codegen Completed in 690ms
Weird - it worked for me just now. Seems like it's failing to install better-sqlite3
. Could you try removing node_modules and try again?
Also, even better, I just now published kysely-codegen@0.2.3
that doesn't install the drivers automatically, so it won't try to install better-sqlite3
if you're not using it.
Everything worked! Thanks!
Also I needed to change what it said on the readme:
kysely-codegen --dialect=pg
to this:
❯ kysely-codegen --dialect=postgres
Oh right! Good call!
Perfect - happy it works! 🥳
Heads up! Just thought of this, but there might be some problems with generated columns (i.e. { id: Generated<number> }
) when inserting new rows.
I made an issue, but it may require some changes in the Kysely introspector: https://github.com/RobinBlomberg/kysely-codegen/issues/2
Hey there,
Just got here from reddit, thanks a lot for this! I tried using kysely-codegen with a localhost postgres, but I'm seeing this error:
After updating my DATABASE_URL to end with
localhost:5432/postgres?sslmode=disable"
as an attempt to workaround it, I saw a success message:But the resulting object is empty:
For reference, my same
.env
file does work with prisma and theschema.prisma
file has been generated.