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

[BUG]: drizzle-kit introspect generates CURRENT_TIMESTAMP without sql operator on date column #2899

Open
kenn opened this issue Sep 3, 2024 · 0 comments
Assignees
Labels
bug Something isn't working drizzle/kit priority Will be worked on next

Comments

@kenn
Copy link

kenn commented Sep 3, 2024

What version of drizzle-orm are you using?

0.33.0

What version of drizzle-kit are you using?

0.24.2

Describe the Bug

When I run drizzle-kit introspect, generated schema.ts is broken on the date type column because CURRENT_TIMESTAMP is not quoted with sql operator.

// broken
export const metrics = pgTable("metrics", {
	date: date("date").default(CURRENT_TIMESTAMP).notNull(),
})

// expected
export const metrics = pgTable("metrics", {
	date: date("date").default(sql`CURRENT_TIMESTAMP`).notNull(),
})

Only occurs on the date column, not on timestamp columns.

Expected behavior

Generate this instead:

sql`CURRENT_TIMESTAMP`

Environment & setup

Using pg v8.12.0

@kenn kenn added the bug Something isn't working label Sep 3, 2024
@L-Mario564 L-Mario564 added drizzle/kit priority Will be worked on next labels Oct 24, 2024
@L-Mario564 L-Mario564 self-assigned this Oct 24, 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 drizzle/kit priority Will be worked on next
Projects
None yet
Development

No branches or pull requests

2 participants