Spaces:
Runtime error
Runtime error
| import { pgTable, text, integer, timestamp, uuid } from "drizzle-orm/pg-core"; | |
| import { createInsertSchema } from "drizzle-zod"; | |
| import { z } from "zod/v4"; | |
| export const clientsTable = pgTable("clients", { | |
| id: integer("id").primaryKey().generatedAlwaysAsIdentity(), | |
| name: text("name").notNull(), | |
| email: text("email"), | |
| phone: text("phone"), | |
| company: text("company"), | |
| notes: text("notes"), | |
| userId: uuid("user_id").notNull(), | |
| createdAt: timestamp("created_at", { withTimezone: true }).defaultNow().notNull(), | |
| updatedAt: timestamp("updated_at", { withTimezone: true }).defaultNow().notNull().$onUpdate(() => new Date()), | |
| }); | |
| export const insertClientSchema = createInsertSchema(clientsTable).pick({ | |
| name: true, | |
| email: true, | |
| phone: true, | |
| company: true, | |
| notes: true, | |
| }); | |
| export type InsertClient = z.infer<typeof insertClientSchema>; | |
| export type Client = typeof clientsTable.$inferSelect; | |