Closed
Description
Hi, having an id PK uuid column of a table (example) makes an id
creation attribute type to be optional. I still have to pass generated uuid v4 when creating though.
CREATE TABLE test (
id uuid primary key,
created_at timestamp without time zone NOT NULL,
updated_at timestamp without time zone,
deleted_at timestamp without time zone
);
results in id
in TestOptionalAttributes
.
export interface TestAttributes {
id: string;
createdAt: Date;
updatedAt?: Date;
deletedAt?: Date;
}
export type TestPk = "id";
export type TestId = Test[TestPk];
export type TestOptionalAttributes = "id" | "updatedAt" | "deletedAt";
export type TestCreationAttributes = Optional<TestAttributes, TestOptionalAttributes>;
When I'm not providing the optional id
when creating the entity, I'm getting the notNull Violation: Test.id cannot be null
This has probably something to do with acd67f6 I see that any fieldObj.primaryKey
field is considered as optional
Metadata
Assignees
Labels
No labels