pigoz / effect-sql

Relational Databases with Effect!

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Generating @effect/schema Schemas

jessekelly881 opened this issue · comments

Hey @pigoz! I just ran into this project and it looks fantastic! I wanted to ask though, do you have any plans to include an effect port of drizzle-zod? Generating effect schemas from a drizzle db definition would be incredible useful. That said, maybe that's outside of the scope of this project.

Hi! Yes, it's something I'm thinking about, but very low priority right now – I'm also thinking about maybe wrapping the drizzle schema definition API in something better (i.e.: making notNull the default).

The current is plan right now is to:
a) Finalize the API

  1. Merge PoolError and PgError in a single DatabaseError, and provide orDie variants of the runQuery functions for it.
  2. Delete the QueryBuilder context dependency.
  3. Make queryExactlyOne smarter so that it doesn't include a TooMany in the inferred error type if we are querying by primary key or single unique key.

b) Allow to use both Kysely and Drizzle as a Query Builder
c) Add automatic generation of fast check arbitraries for test factories using the Drizzle schema as input – this might as well happen through @effect/schema support
d) Add multiple database support (MySQL, SQLite)

Very nice! Seems like a great direction to go in. Also, out of curiosity, will this library work with the normal drizzle cli(i.e. drizzle kit) for generating migrations?

Yes, it already does work with drizzle-kit!