sayuto
sayuto
DTDrizzle Team
Created by sayuto on 10/27/2024 in #help
$returningId is not a function
I am trying to get the ID of the newly inserted record I use mysql according to the document, I try to use $returningId but it doesn't work, my ide gives an error not found
const result = await db
.insert(comments)
.values({
bookId,
chapterId,
userId,
content: escapedContent,
})
.$returningId();
const result = await db
.insert(comments)
.values({
bookId,
chapterId,
userId,
content: escapedContent,
})
.$returningId();
1 replies
DTDrizzle Team
Created by sayuto on 8/7/2024 in #help
Studio + mysql default mode, wrong format related timezone
What version of drizzle-orm are you using? 0.31.2 What version of drizzle-kit are you using? 0.22.8 Describe the Bug When I Add a new record in the studio https://local.drizzle.studio/ or insert data in mysql cli by sql raw createdAt will return the correct time but wrong format my local time is: 2024-08-04 09:42:20.000 data in the studio: 2024-08-04T02:42:20.000Z data that I get in backend: 2024-08-04T09:42:20.000Z data that I get in MySQL: 2024-08-04 09:42:20 my schema createdAt: timestamp('created_at', { mode: 'date' }).defaultNow().notNull(), as i understand, mysql is displaying data according to system timezone studio/backend misunderstands timezone or does not have timezone config which makes it "think" data is utc and display data in utc format update If I set env is TZ=UTC studio will show: 2024-08-04T09:42:20.000Z backend still show: 2024-08-04T09:42:20.000Z -> still wrong Expected behavior orm should show get data with the correct format/time
48 replies
DTDrizzle Team
Created by sayuto on 8/6/2024 in #help
DrizzleTypeError<"Seems like the schema generic is missing - did you forget to add it to your DB typ
No description
9 replies