browntiger
browntiger
DTDrizzle Team
Created by browntiger on 1/10/2025 in #help
Drizzle-Zod extend schema....
Figured out, it does not need the field name anymore. id: (schema) => schema.uuid() [it does not need schema.id.uuid()]
3 replies
DTDrizzle Team
Created by browntiger on 1/10/2025 in #help
Drizzle-Zod extend schema....
Base table export const feedbacks = createTable( "feedback", { id: varchar("id", { length: 255 }) .notNull() .primaryKey() .$defaultFn(() => crypto.randomUUID()), userId: varchar("userId", { length: 255 }) .notNull() .references(() => users.id, { onDelete: "cascade" }), title: varchar("title", { length: 255 }), message: text("message").notNull(), label: feedbackLabelEnum("label").notNull(), status: feedbackStatusEnum("status").default("Open").notNull(), comment: varchar("comment", { length: 255 }), ...timestamps, }, (t) => [index("dds_idx_feedback_email").on(t.userId)], )
3 replies
DTDrizzle Team
Created by browntiger on 12/9/2024 in #help
Drizzle ORM issues
After few hours: it appears that all caused by this .$onUpdate(() => sql(now() AT TIME ZONE 'utc'::text)), just left the index on updatedAt and it breaks. Drizzle-kit 0.30.0
4 replies
DTDrizzle Team
Created by browntiger on 12/9/2024 in #help
Drizzle ORM issues
My schema export const users = createTable("users", { id: text("id") .primaryKey() .default(sqlgen_random_uuid()), name: varchar("name", { length: 255 }), email: varchar("email", { length: 255 }).notNull(), emailVerified: timestamp("emailVerified", { mode: "date", withTimezone: true, }), image: varchar("image", { length: 255 }), password: varchar("password", { length: 100 }), role: varchar("role", { length: 255 }).default("User").notNull(), isNewUser: boolean("isNewUser").default(true).notNull(), invalid_login_attempts: integer("invalid_login_attempts") .default(0) .notNull(), lockedAt: timestamp("lockedAt", { mode: "date", withTimezone: true, }), isTwoFactorEnabled: boolean("isTwoFactorEnabled").default(false).notNull(), createdAt: timestamp("created_at", { withTimezone: true, mode: "date" }) .default(sql(now() AT TIME ZONE 'utc'::text)) .notNull(), updatedAt: timestamp("updated_at", { withTimezone: true, mode: "date" }) .default(sql(now() AT TIME ZONE 'utc'::text)) .notNull() .$onUpdate(() => sql(now() AT TIME ZONE 'utc'::text)), })
4 replies
DTDrizzle Team
Created by browntiger on 12/9/2024 in #help
Drizzle ORM issues
The data was inserted by simple db.insert(users).values(name, email, password)
4 replies