feat(04-01): add formTemplates table and extend documents schema

- Add formTemplates table (id text PK, name, filename unique, createdAt, updatedAt)
- Add formTemplateId (nullable FK) and filePath (nullable text) to documents table
- Generate and apply migration 0002_wealthy_zzzax.sql
- Create seeds/forms/.gitkeep to track seed directory in git
This commit is contained in:
Chandler Copeland
2026-03-19 21:32:30 -06:00
parent c896fa5e82
commit bbbbdbed5e
5 changed files with 294 additions and 0 deletions

View File

@@ -22,6 +22,14 @@ export const clients = pgTable("clients", {
updatedAt: timestamp("updated_at").defaultNow().notNull(),
});
export const formTemplates = pgTable("form_templates", {
id: text("id").primaryKey().$defaultFn(() => crypto.randomUUID()),
name: text("name").notNull(),
filename: text("filename").notNull().unique(),
createdAt: timestamp("created_at").defaultNow().notNull(),
updatedAt: timestamp("updated_at").defaultNow().notNull(),
});
export const documents = pgTable("documents", {
id: text("id").primaryKey().$defaultFn(() => crypto.randomUUID()),
name: text("name").notNull(),
@@ -31,4 +39,6 @@ export const documents = pgTable("documents", {
status: documentStatusEnum("status").notNull().default("Draft"),
sentAt: timestamp("sent_at"),
createdAt: timestamp("created_at").defaultNow().notNull(),
formTemplateId: text("form_template_id").references(() => formTemplates.id),
filePath: text("file_path"),
});