Skip to content

Commit

Permalink
Added created_at and updated_at fields, changed id type to String and…
Browse files Browse the repository at this point in the history
… default it to uuid()
  • Loading branch information
V-Mokhun committed Sep 29, 2023
1 parent e091df2 commit cbf9198
Showing 1 changed file with 18 additions and 15 deletions.
33 changes: 18 additions & 15 deletions prisma/schema.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,17 @@ datasource db {
}

model User {
id Int @id @default(autoincrement())
email String @unique
name String
id String @id @default(uuid())
email String @unique
name String
created_at DateTime @default(now())
updated_at DateTime @updatedAt
work_requests WorkRequest[]
}

model Work {
id Int @id @default(autoincrement())
id String @id @default(uuid())
description String
start_date DateTime
approval_date DateTime
Expand All @@ -32,26 +34,27 @@ model Work {
}

model Authority {
id Int @id @default(autoincrement())
name String
email String @unique
id String @id @default(uuid())
name String
email String @unique
work_type Int
work_requests WorkRequest[]
}

model WorkRequest {
rating Float
rating Float
created_at DateTime @default(now())
updated_at DateTime @updatedAt
work_id Int @unique //? remove @unique if work can have more than one request
work Work @relation(fields: [work_id], references: [id])
work_id String @unique //? remove @unique if work can have more than one request
work Work @relation(fields: [work_id], references: [id])
user_id Int
user User @relation(fields: [user_id], references: [id])
approving_authority_id Int
approving_authority Authority @relation(fields: [approving_authority_id], references: [id])
user_id String
user User @relation(fields: [user_id], references: [id])
approving_authority_id String
approving_authority Authority @relation(fields: [approving_authority_id], references: [id])
@@id([work_id, user_id])
}

0 comments on commit cbf9198

Please sign in to comment.