Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

@effect/sql-drizzle returns a date when it should return a string #3701

Open
amosbastian opened this issue Sep 28, 2024 · 0 comments
Open

@effect/sql-drizzle returns a date when it should return a string #3701

amosbastian opened this issue Sep 28, 2024 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@amosbastian
Copy link

What version of Effect is running?

3.8.4

What steps can reproduce the bug?

import { Schema } from "@effect/schema";
import * as PgDrizzle from "@effect/sql-drizzle/Pg";
import "dotenv/config";
import { eq } from "drizzle-orm";
import { Effect } from "effect";
import { DatabaseLive } from "./database";
import { SelectUserSchema, userTable } from "./schema";

Effect.gen(function* () {
  const db = yield* PgDrizzle.PgDrizzle;
  const email = "[email protected]";
  yield* db.delete(userTable).where(eq(userTable.email, email));
  yield* db.insert(userTable).values({ email });
  const user = (yield* db.select().from(userTable)).at(0);

  if (user) {
    console.log(typeof user.id, user.id);
    console.log(typeof user.createdAt, user.createdAt);
    console.log(typeof user.updatedAt, user.updatedAt);
    console.log(typeof user.deletedAt, user.deletedAt);
    Schema.decodeUnknownSync(SelectUserSchema)(user);
  }
}).pipe(Effect.provide(DatabaseLive), Effect.runPromise);

What is the expected behavior?

When using drizzle-orm directly it outputs:

string user_b329aa7b399b4f5b8b11870f3b25f66d
string 2024-09-25 08:48:38.961462+02
string 2024-09-25 08:48:38.961462+02
object null

What do you see instead?

string user_b329aa7b399b4f5b8b11870f3b25f66d
object 2024-09-25T06:48:38.961Z
object 2024-09-25T06:48:38.961Z
object null

Additional information

https://github.com/amosbastian/effect-drizzle

@amosbastian amosbastian added the bug Something isn't working label Sep 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants