You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have verified that the bug I'm about to report hasn't been filed before.
What version of drizzle-orm are you using?
0.36.1
What version of drizzle-kit are you using?
0.28.0
Other packages
No response
Describe the Bug
Using database first, I have an existing table that looks like this
CREATE TABLE example(
id integer primary key GENERATED BY DEFAULT AS IDENTITY,
valid_to timestamptz,
created timestamptz NOT NULL,
updated timestamptz NOT NULL
);
The drizzle-kit generated schema might look like this
As you can see, the optional/nullable fields have different types. This means I can't use the inferInsert data to compose an inferSelect data like I want to do in my unit/e2e tests.
const inputData: ExampleInferInsert = {
validTo: null,
created: new Date(),
updated: new Date()
};
// complains about validTo's type from ExampleInferInsert not being compatible with ExampleInferSelect's validTo type
const expected: ExampleInferSelect = {
...inputData,
id: expect.any(Number),
}
// complains about validTo's type from ExampleInferInsert not being compatible with ExampleInferSelect's validTo type
const expected0: ExampleInferSelect = {
...inputData,
id: 0,
}
const actual = await dao.save(inputData);
expect(actual).toEqual(expected);
My expectation is that I could use the $inferInsert to compose a $selectInput. Maybe there is a way for the $inferInsert to not have it be undefined and just be or null?
The text was updated successfully, but these errors were encountered:
Report hasn't been filed before.
What version of
drizzle-orm
are you using?0.36.1
What version of
drizzle-kit
are you using?0.28.0
Other packages
No response
Describe the Bug
Using database first, I have an existing table that looks like this
The drizzle-kit generated schema might look like this
The $inferInsert type will evaluate to
The $inferSelect type will evaluate to
As you can see, the optional/nullable fields have different types. This means I can't use the inferInsert data to compose an inferSelect data like I want to do in my unit/e2e tests.
My expectation is that I could use the $inferInsert to compose a $selectInput. Maybe there is a way for the $inferInsert to not have it be undefined and just be or null?
The text was updated successfully, but these errors were encountered: