We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
drizzle-orm
0.29.3
drizzle-kit
0.20.12
The smallserial, serial and bigserial datatypes with the postgres.js driver are configured with hasDefault=true and notNull=true.
smallserial
serial
bigserial
postgres.js
hasDefault=true
notNull=true
However, smallserial is missing the NotNull and HasDefault type helpers wrapped around the builder.
NotNull
HasDefault
Therefore, when you try to insert a row into a table with a smallserial column, you are required to provide an input.
export const examples = pgTable("examples", { id: smallserial("id").notNull().primaryKey(), });
await this.drizzle .insert(examples) .values({}); // Property 'id' is missing in type '{}' but required in type '{ id: number; }'
Ignoring the type error successfully inserts a row
await this.drizzle .insert(examples) .values({} as unknown as typeof examples.$inferInsert);
smallint columns should be optional when inserting to match the behaviour of serial and bigserial
smallint
Node v20.11.0
The text was updated successfully, but these errors were encountered:
No branches or pull requests
What version of
drizzle-orm
are you using?0.29.3
What version of
drizzle-kit
are you using?0.20.12
Describe the Bug
The
smallserial
,serial
andbigserial
datatypes with thepostgres.js
driver are configured withhasDefault=true
andnotNull=true
.However,
smallserial
is missing theNotNull
andHasDefault
type helpers wrapped around the builder.Therefore, when you try to insert a row into a table with a
smallserial
column, you are required to provide an input.Example table
Example insert query
Workaround
Ignoring the type error successfully inserts a row
Expected behavior
smallint
columns should be optional when inserting to match the behaviour ofserial
andbigserial
Environment & setup
Node v20.11.0
The text was updated successfully, but these errors were encountered: