feat(05-01): extend documents schema with 4 new columns + migration 0003
- Added SignatureFieldData interface export to schema.ts - Added signatureFields (jsonb), textFillData (jsonb), assignedClientId (text), preparedFilePath (text) nullable columns to documents table - Added jsonb import to drizzle-orm/pg-core imports - Generated and applied migration 0003_cool_natasha_romanoff.sql Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1,6 +1,15 @@
|
||||
import { pgEnum, pgTable, text, timestamp } from "drizzle-orm/pg-core";
|
||||
import { jsonb, pgEnum, pgTable, text, timestamp } from "drizzle-orm/pg-core";
|
||||
import { relations } from "drizzle-orm";
|
||||
|
||||
export interface SignatureFieldData {
|
||||
id: string;
|
||||
page: number; // 1-indexed
|
||||
x: number; // PDF user space, bottom-left origin, points
|
||||
y: number; // PDF user space, bottom-left origin, points
|
||||
width: number; // PDF points (default: 144 — 2 inches)
|
||||
height: number; // PDF points (default: 36 — 0.5 inches)
|
||||
}
|
||||
|
||||
export const users = pgTable("users", {
|
||||
id: text("id").primaryKey().$defaultFn(() => crypto.randomUUID()),
|
||||
email: text("email").notNull().unique(),
|
||||
@@ -42,6 +51,10 @@ export const documents = pgTable("documents", {
|
||||
createdAt: timestamp("created_at").defaultNow().notNull(),
|
||||
formTemplateId: text("form_template_id").references(() => formTemplates.id),
|
||||
filePath: text("file_path"),
|
||||
signatureFields: jsonb("signature_fields").$type<SignatureFieldData[]>(),
|
||||
textFillData: jsonb("text_fill_data").$type<Record<string, string>>(),
|
||||
assignedClientId: text("assigned_client_id"),
|
||||
preparedFilePath: text("prepared_file_path"),
|
||||
});
|
||||
|
||||
export const documentsRelations = relations(documents, ({ one }) => ({
|
||||
|
||||
Reference in New Issue
Block a user