Skip to content

Commit 798fa7e

Browse files
authored
Merge pull request #36 from Nandgopal-R/feat/templates
feat:adding template and template_fields schema
2 parents a1182f5 + a9b63ed commit 798fa7e

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

prisma/schema.prisma

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ model User {
1818
accounts Account[]
1919
formResponses FormResponse[]
2020
sessions Session[]
21+
templates Template[]
2122
2223
@@map("user")
2324
}
@@ -99,6 +100,40 @@ model FormFields {
99100
@@map("form_fields")
100101
}
101102

103+
model Template {
104+
id String @id @default(uuid())
105+
title String
106+
description String?
107+
ownerId String?
108+
isBuiltIn Boolean @default(false)
109+
sourceTemplateId String?
110+
createdAt DateTime @default(now())
111+
updatedAt DateTime @updatedAt
112+
owner User? @relation(fields: [ownerId], references: [id], onDelete: Cascade)
113+
templateFields TemplateField[]
114+
115+
@@map("template")
116+
}
117+
118+
model TemplateField {
119+
id String @id @default(uuid())
120+
fieldName String
121+
label String?
122+
fieldValueType String
123+
fieldType String
124+
validation Json?
125+
options Json?
126+
prevFieldId String?
127+
createdAt DateTime @default(now())
128+
updatedAt DateTime @updatedAt
129+
templateId String
130+
template Template @relation(fields: [templateId], references: [id], onDelete: Cascade)
131+
132+
@@index([templateId])
133+
@@index([templateId, prevFieldId])
134+
@@map("template_fields")
135+
}
136+
102137
model FormResponse {
103138
id String @id @default(uuid())
104139
formId String

0 commit comments

Comments
 (0)