[BUG]:drizzle-zod doesn't accept custom id value #2957
Description
What version of drizzle-orm
are you using?
0.33.3
What version of drizzle-kit
are you using?
0.22.7
Describe the Bug
I have a table that historically had been defined with custom Id
when we created drizzle we did it with the following value:
export const marketingSmsMessages = mysqlTable( 'marketing_sms_messages', { id: varchar('id', { length: 36 }).notNull(),
When trying to run:
const insertMarketingSmsMessageSchema = createInsertSchema(marketingSmsMessages)
get the following error:
Argument of type 'MySqlTableWithColumns<{ name: "marketing_sms_messages"; schema: undefined; columns: { id: MySqlColumn<{ name: "id"; tableName: "marketing_sms_messages"; dataType: "string"; columnType: "MySqlVarChar"; data: string; driverParam: string | number; notNull: true; hasDefault: false; enumValues: [...]; baseColumn: never; ...' is not assignable to parameter of type 'Table<TableConfig<Column<any, object, object>>>'. The types of '_.config.columns' are incompatible between these types. Type '{ id: MySqlColumn<{ name: "id"; tableName: "marketing_sms_messages"; dataType: "string"; columnType: "MySqlVarChar"; data: string; driverParam: string | number; notNull: true; hasDefault: false; enumValues: [...]; baseColumn: never; }, object>; ... 16 more ...; updatedAt: MySqlColumn<...>; }' is not assignable to type 'Record<string, Column<any, object, object>>'. Property 'id' is incompatible with index signature. Type 'MySqlColumn<{ name: "id"; tableName: "marketing_sms_messages"; dataType: "string"; columnType: "MySqlVarChar"; data: string; driverParam: string | number; notNull: true; hasDefault: false; enumValues: [...]; baseColumn: never; }, object>' is missing the following properties from type 'Column<any, object, object>': generated, generatedIdentity
Expected behavior
I expected the insert schema to just parse the schema in use and give a 1 to 1 zod schema.
as without it I need to manually create zod schema for each table
Environment & setup
No response