drizzle-team / drizzle-team/drizzle-orm

[BUG]: .default() method accepts Date object but should only accept SQL

Open
#1,777 1 comment 1 reaction 1 assignee Claimed by @Angelelz View on GitHub
bug bug/fixed-in-beta db/sqlite drizzle/kit priority
Dominant language
TypeScript
Stars
35.8k
Forks
1.6k
Avg merge
2d 7h
Merged PRs (30d)
4

Description

### What version of `drizzle-orm` are you using?

0.29.1

### What version of `drizzle-kit` are you using?

0.20.6

### Describe the Bug

This relates to https://github.com/drizzle-team/drizzle-orm/issues/1105#issuecomment-1879238290.

When using an integer column in timestamp mode, the `.default` method accepts a type of `SQL | Date`. It should only accept `SQL`.

A consequence of this is that developers who try to generate migrations using a `Date` object will end up with a script that does not execute.

See screenshot of function argument type annotation:

Screenshot 2024-01-09 at 6 49 38 PM

### Expected behavior

The function argument type should only be `SQL`

### Environment & setup

Tested on NodeJS 20

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.