Effect CommunityEC
Effect Community3mo ago
9 replies
Near

Issues with Drizzle and SqlClient Integration in Effect Typescript Library

I am having issues wherein using Effect's Drizzle, a conventional SqlClient, and an non-effectful instance of Drizzle behave erroneous. Changes done to a database via one interface are not reflected by the other under some inexplicable conditions. Repository with the test file in question over here: https://github.com/ChristianIvicevic/sql-drizzle-repro/blob/main/test/integration.test.ts

The problems are as follows:
1. migrate doesn't accept the db object obtained via yield* Drizzle. It fails with a cryptic error message.
2. After the migration with a non-effectful Drizzle client neither the effectful instance with yield* db.select().from(sampleTable) nor the SqlClient.SqlClient with yield* sql"SELECT * FROM repro_sample" find the tables created via the migration even though I can confirm that they do exist.
3. Only after manually uncommenting the CREATE TABLE command using the SqlClient.SqlClient instance the Drizzle query underneath succeeds.

Really looking for insights on what is wrong here.
Was this page helpful?