drizzle-orm
drizzle-orm copied to clipboard
[FEATURE]: default() should accept a function generator
Describe want to want
Let's say I wanted to create a Primary Key that took by default a ulid as a generator whenever a new record was added:
We should be able to do something like:
import { ulid } from 'ulid'
import { sqliteTable, text } from 'drizzle-orm/sqlite-core'
export const bodies = sqliteTable('bodies', {
id: text('id').primaryKey().default(ulid)
})
Without the type system asking for a default string. I could use as ulid(), but this would obviously hard set the default for all records ...
connected to #556
Duplicate of #304?
any update about it?
Will close this issue in favour of #304