drizzle-zod insert user without id
export const users = mysqlTable("users", {
id: int("id").autoincrement().primaryKey(),
email: varchar("email", { length: 256 }).unique().notNull(),
name: varchar("name", { length: 120 }).notNull(),
password: varchar("password", { length: 256 }).notNull(),
createdAt: timestamp("created_at")
.default(sql`CURRENT_TIMESTAMP`)
.notNull(),
updatedAt: timestamp("updated_at").onUpdateNow(),
});
export const insertUserSchema = createInsertSchema(users);
// ^^ all fields in user table
export const users = mysqlTable("users", {
id: int("id").autoincrement().primaryKey(),
email: varchar("email", { length: 256 }).unique().notNull(),
name: varchar("name", { length: 120 }).notNull(),
password: varchar("password", { length: 256 }).notNull(),
createdAt: timestamp("created_at")
.default(sql`CURRENT_TIMESTAMP`)
.notNull(),
updatedAt: timestamp("updated_at").onUpdateNow(),
});
export const insertUserSchema = createInsertSchema(users);
// ^^ all fields in user table
0 Replies