zeekrey
zeekrey
DTDrizzle Team
Created by zeekrey on 11/28/2023 in #help
Custom error messages with drizzle-zod?
Hey there! 👋 Does somebody know how to add custom error messages to a schema created via createInsertSchema? I know I can refine the schema by passing an object as the second argument, but since the error messages are part of the actual type definition, I would be repeating myself like so:
export const users = sqliteTable("users", {
id: integer("id").primaryKey().notNull()
});

const zodSchema = createInsertSchema(users, {
id: (schema) => schema.id.number({
required_error: "Id is required",
invalid_type_error: "Id must be a number",
});
export const users = sqliteTable("users", {
id: integer("id").primaryKey().notNull()
});

const zodSchema = createInsertSchema(users, {
id: (schema) => schema.id.number({
required_error: "Id is required",
invalid_type_error: "Id must be a number",
});
6 replies
DTDrizzle Team
Created by zeekrey on 11/24/2023 in #help
Is there a --force flag for drizzle-kit push?
Hey there! 👋 I'm having all sorts of problems when pushing changes to my database during prototyping. I end up deleting the SQLite DB and creating a new one. Is there a way to somehow force push the changes?
2 replies