@@ -24,6 +24,7 @@ model User {
2424 updatedAt DateTime @default (now () ) @updatedAt
2525 todos Todo []
2626 collaborators Collaborator []
27+ TodoHistory TodoHistory []
2728}
2829
2930model Todo {
@@ -39,26 +40,47 @@ model Todo {
3940 images Image [] // Relation to the Image model
4041 collaborators Collaborator []
4142 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 ] )
4261}
4362
4463model 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 ?
5171}
5272
5373model 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 ?
6284
6385 @@unique ([userId , todoId ] )
6486}
0 commit comments