-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Report hasn't been filed before.
- I have verified that the bug I'm about to report hasn't been filed before.
What version of drizzle-orm are you using?
1.0.0-beta.8-734e789
What version of drizzle-kit are you using?
1.0.0-beta.8-734e789
Other packages
No response
Describe the Bug
When running drizzle-kit pull on a MySQL database with datetime columns that have DEFAULT CURRENT_TIMESTAMP and ON UPDATE CURRENT_TIMESTAMP, the generated schema contains two issues:
Issue 1: new Date("CURRENT_TIMESTAMPZ") generates Invalid Date
DDL:
`created_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,Generated:
created_at: datetime().default(new Date("CURRENT_TIMESTAMPZ")).notNull(),new Date("CURRENT_TIMESTAMPZ") produces Invalid Date in JavaScript.
Issue 2: onUpdateNow() is generated for datetime, but only supported on timestamp
DDL:
`updated_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,Generated:
updated_at: datetime().default(new Date("CURRENT_TIMESTAMPZ")).onUpdateNow().notNull(),This causes a TypeScript error:
Property 'onUpdateNow' does not exist on type 'MySqlDateTimeBuilder'. Did you mean '$onUpdateFn'?
onUpdateNow() is only available on timestamp columns, not datetime.
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working