Majed
DTDrizzle Team
•Created by Majed on 1/6/2024 in #help
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
1 replies