drizzle-zod refine enum

Here's my users table and the schema generated with
drizzle-zod
that I want to modify. As you can see, the role column is an enum, but I want to modify the error message as I did with email and password. I've tried several solutions but nothing works, could you help me?
export const roleEnum = pgEnum('role', ['USER', 'ADMIN'])

export const users = pgTable('users', {
  id: serial('id').primaryKey(),
  email: varchar('email', {
    length: 256,
  })
    .unique()
    .notNull(),
  password: varchar('password', {
    length: 256,
  }).notNull(),
  role: roleEnum('role').notNull(),
})

export const insertUserSchema = createInsertSchema(users, {
  email: schema => schema.email.email("Format de l'adresse email incorrect"),
  password: schema => schema.password.min(8, "Le mot de passe doit contenir au moins 8 caractères"),
})
Was this page helpful?