add: deployment & fix cascading issues
This commit is contained in:
parent
40744a0502
commit
dd98781cc5
|
@ -51,6 +51,7 @@ model User {
|
|||
accounts Account[]
|
||||
sessions Session[]
|
||||
Workspace Workspace[]
|
||||
Deployment Deployment[]
|
||||
}
|
||||
|
||||
model VerificationToken {
|
||||
|
@ -71,6 +72,7 @@ model Workspace {
|
|||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
Application Application[]
|
||||
Deployment Deployment[]
|
||||
}
|
||||
|
||||
model Application {
|
||||
|
@ -82,8 +84,31 @@ model Application {
|
|||
repositoryId String
|
||||
path String
|
||||
autoDeploy Boolean
|
||||
Workspace Workspace @relation(fields: [workspaceId], references: [id])
|
||||
workspaceId String
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
Deployment Deployment[]
|
||||
|
||||
Workspace Workspace @relation(fields: [workspaceId], references: [id], onDelete: Cascade)
|
||||
}
|
||||
|
||||
enum DeploymentStatus {
|
||||
PENDING
|
||||
IN_PROGRESS
|
||||
FAILED
|
||||
SUCCESS
|
||||
}
|
||||
|
||||
model Deployment {
|
||||
id String @id @default(cuid())
|
||||
applicationId String
|
||||
workspaceId String
|
||||
userId String
|
||||
status DeploymentStatus @default(PENDING)
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
|
||||
Application Application @relation(fields: [applicationId], references: [id], onDelete: Cascade)
|
||||
Workspace Workspace @relation(fields: [workspaceId], references: [id], onDelete: Cascade)
|
||||
User User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue