How to remove the space between timestamp and precision?

When I run drizzle kit generate
drizzle-kit generate:pg --config=custom.config.ts
drizzle-kit generate:pg --config=custom.config.ts
, I got
ALTER TABLE "Requests" ALTER COLUMN "createdAt" SET DATA TYPE timestamp (3);
ALTER TABLE "Requests" ALTER COLUMN "createdAt" SET DATA TYPE timestamp (3);
I already have the table with timestamp(3) but it was generated because there was space between timestamp and precision. How to solve this problem? I'm using "drizzle-kit": "^0.20.14", and "drizzle-orm": "^0.30.0"
4 Replies
Jim
Jim9mo ago
hey @Ghostman facing the same issue, did you find a workaround? fixed by setting the timestamp to a sting e.g.
createdAt: timestamp("created_at", {precision: 3, mode: 'string' }).defaultNow().notNull()
createdAt: timestamp("created_at", {precision: 3, mode: 'string' }).defaultNow().notNull()
Ghostman
GhostmanOP9mo ago
But if I set the timestamp to string, I'm having typescript error on my project because the "created_at" was set as date @Jim is there any other solution with using mode "date"?
Jim
Jim8mo ago
@Ghostman hey ghostman sorry i missed this! Unfortunalty not, I will let you know if I find a workaround without converting to string
Jim
Jim8mo ago
GitHub
[BUG]: data loss when using timestamp(3) and push command · Issu...
What version of drizzle-orm are you using? 0.30.8 What version of drizzle-kit are you using? 0.20.14 Describe the Bug When I have the following in my table schema: createdAt: timestamp("create...
Want results from more Discord servers?
Add your server