1- // This is your Prisma schema file,
2- // learn more about it in the docs: https://pris.ly/d/prisma-schema
3-
4- // Looking for ways to speed up your queries, or scale easily with your serverless or edge functions?
5- // Try Prisma Accelerate: https://pris.ly/cli/accelerate-init
6-
71generator client {
82 provider = " prisma-client-js "
93}
@@ -21,37 +15,38 @@ model User {
2115 pollsCreatedCount Int @default (0 )
2216 pollsParticipatedCount Int @default (0 )
2317 createdPolls Poll [] @relation (" PollAuthor " )
24- votes Vote []
2518 actions UserAction []
19+ votes Vote []
2620}
2721
2822model UserAction {
2923 id Int @id @default (autoincrement () )
3024 userId Int
3125 pollId Int
3226 type ActionType
33- user User @relation (fields : [userId ] , references : [id ] )
34- poll Poll @relation (fields : [pollId ] , references : [pollId ] , onDelete : Cascade )
3527 createdAt DateTime @default (now () )
3628 updatedAt DateTime @default (now () ) @updatedAt
29+ poll Poll @relation (fields : [pollId ] , references : [pollId ] , onDelete : Cascade )
30+ user User @relation (fields : [userId ] , references : [id ] )
3731}
3832
3933model Poll {
40- pollId Int @id @default (autoincrement () )
34+ pollId Int @id @default (autoincrement () )
4135 authorUserId Int
4236 title String
4337 description String ?
4438 options String []
45- creationDate DateTime @default (now () )
39+ creationDate DateTime @default (now () )
4640 startDate DateTime
4741 endDate DateTime
4842 tags String []
49- isAnonymous Boolean @default (false )
50- participantCount Int @default (0 )
43+ isAnonymous Boolean @default (false )
44+ participantCount Int @default (0 )
5145 voteResults Json
52- author User @relation ( " PollAuthor " , fields : [ authorUserId ] , references : [ id ] )
53- votes Vote []
46+ searchVector Unsupported ("tsvector")?
47+ author User @relation ( " PollAuthor " , fields : [ authorUserId ] , references : [ id ] )
5448 userAction UserAction []
49+ votes Vote []
5550}
5651
5752model Vote {
@@ -60,10 +55,10 @@ model Vote {
6055 pollId Int
6156 votingPower Int
6257 weightDistribution Json
63- quadraticWeights Json ? // DO NOT INSERT INTO THIS, THIS IS A GENERATED COLUMN
6458 proof String
65- user User @relation ( fields : [ userId ] , references : [ id ] )
59+ quadraticWeights Json ? @default ( dbgenerated ( " calculate_quadratic_weights ( \ " weightDistribution \ " ) " ) )
6660 poll Poll @relation (fields : [pollId ] , references : [pollId ] , onDelete : Cascade )
61+ user User @relation (fields : [userId ] , references : [id ] )
6762}
6863
6964enum ActionType {
0 commit comments