-
-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Report hasn't been filed before.
- 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.44.2
What version of drizzle-kit are you using?
0.31.2
Other packages
No response
Describe the Bug
I have this table:
export const unitsI18N = pgTable(
'units_i18n',
{
id: text()
.primaryKey()
.$defaultFn(() => DbUtils.cuid2()),
dataId: text()
.notNull()
.references(() => units.id, {
onDelete: 'cascade',
onUpdate: 'cascade',
}),
locale: text()
.notNull()
.references(() => locales.code, { onUpdate: 'cascade' }),
name: text(),
description: text(),
},
(table) => [
{
uniqueDataIdLocale: unique().on(table.dataId, table.locale),
},
],
);When I do export const DbUnitInputSchema = createInsertSchema(units);
And then I do type UnitTranslation = Schema.Schema.Type<typeof DbUnitInputSchema>
Then I get a schema definition like so:
Schema.Struct({
locale: Schema.String,
dataId: Schema.String,
name: Schema.NullishOr(Schema.String),
description: Schema.NullishOr(Schema.String),
otherNames: Schema.NullishOr(Schema.String),
acronyms: Schema.NullishOr(Schema.String),
});which gives this type:
{
locale: string;
dataId: string;
name: string | null | undefined;
description: string | null | undefined;
}Ideally it should be:
Schema.Struct({
locale: Schema.String,
dataId: Schema.String,
name: Schema.NullOr(Schema.String),
description: Schema.NullOr(Schema.String),
otherNames: Schema.NullOr(Schema.String),
acronyms: Schema.NullOr(Schema.String),
});
Which would give this type signature.
{
locale: string;
dataId: string;
name: string | null;
description: string | null;
}Is this a bug or the default behaviour?
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working