Spaces:
Runtime error
Runtime error
File size: 1,334 Bytes
1804b24 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | import { pgTable, text, integer, doublePrecision, timestamp, uuid } from "drizzle-orm/pg-core";
import { createInsertSchema } from "drizzle-zod";
import { z } from "zod/v4";
import { clientsTable } from "./clients";
export const projectsTable = pgTable("projects", {
id: integer("id").primaryKey().generatedAlwaysAsIdentity(),
title: text("title").notNull(),
description: text("description"),
clientId: integer("client_id").references(() => clientsTable.id, { onDelete: "set null" }),
status: text("status").notNull().default("briefing"),
priority: text("priority").notNull().default("medium"),
budget: doublePrecision("budget"),
deadline: text("deadline"),
driveUrl: text("drive_url"),
planUrl: text("plan_url"),
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 insertProjectSchema = createInsertSchema(projectsTable).pick({
title: true,
description: true,
clientId: true,
status: true,
priority: true,
budget: true,
deadline: true,
driveUrl: true,
planUrl: true,
});
export type InsertProject = z.infer<typeof insertProjectSchema>;
export type Project = typeof projectsTable.$inferSelect;
|