@@ -24,6 +24,7 @@ model User {
24
24
updatedAt DateTime @default (now () ) @updatedAt
25
25
todos Todo []
26
26
collaborators Collaborator []
27
+ TodoHistory TodoHistory []
27
28
}
28
29
29
30
model Todo {
@@ -39,26 +40,47 @@ model Todo {
39
40
images Image [] // Relation to the Image model
40
41
collaborators Collaborator []
41
42
lastModifiedBy String @default (" " )
43
+ TodoHistory TodoHistory []
44
+ }
45
+
46
+ model TodoHistory {
47
+ id String @id @default (uuid () )
48
+ todoId String
49
+ title String ?
50
+ description String ?
51
+ done Boolean ?
52
+ todoColor String ?
53
+ lastModifiedBy String
54
+ createdAt DateTime @default (now () )
55
+ collaborators Collaborator []
56
+ userId String ?
57
+ user User ? @relation (fields : [userId ] , references : [id ] )
58
+ Todo Todo @relation (fields : [todoId ] , references : [id ] )
59
+
60
+ @@index ([todoId ] )
42
61
}
43
62
44
63
model Image {
45
- id String @id @default (cuid () )
46
- url String
47
- todo Todo @relation (fields : [todoId ] , references : [id ] , onDelete : Cascade )
48
- todoId String
49
- createdAt DateTime @default (now () )
50
- updatedAt DateTime @default (now () ) @updatedAt
64
+ id String @id @default (cuid () )
65
+ url String
66
+ todo Todo @relation (fields : [todoId ] , references : [id ] , onDelete : Cascade )
67
+ todoId String
68
+ createdAt DateTime @default (now () )
69
+ updatedAt DateTime @default (now () ) @updatedAt
70
+ todoHistoryId String ?
51
71
}
52
72
53
73
model Collaborator {
54
- id String @id @default (cuid () )
55
- user User @relation (fields : [userId ] , references : [id ] )
56
- userId String
57
- todo Todo @relation (fields : [todoId ] , references : [id ] , onDelete : Cascade )
58
- todoId String
59
- isOwner Boolean @default (false )
60
- createdAt DateTime @default (now () )
61
- updatedAt DateTime @default (now () ) @updatedAt
74
+ id String @id @default (cuid () )
75
+ user User @relation (fields : [userId ] , references : [id ] )
76
+ userId String
77
+ todo Todo @relation (fields : [todoId ] , references : [id ] , onDelete : Cascade )
78
+ todoId String
79
+ isOwner Boolean @default (false )
80
+ createdAt DateTime @default (now () )
81
+ updatedAt DateTime @default (now () ) @updatedAt
82
+ TodoHistory TodoHistory ? @relation (fields : [todoHistoryId ] , references : [id ] )
83
+ todoHistoryId String ?
62
84
63
85
@@unique ([userId , todoId ] )
64
86
}
0 commit comments