|
| 1 | +generator client { |
| 2 | + provider = "prisma-client-js" |
| 3 | +} |
| 4 | + |
| 5 | +datasource db { |
| 6 | + provider = "postgresql" |
| 7 | + url = "***" |
| 8 | +} |
| 9 | + |
| 10 | +model Build { |
| 11 | + id String @id @default(uuid()) |
| 12 | + ciBuildId String? |
| 13 | + number Int? |
| 14 | + branchName String? |
| 15 | + status String? |
| 16 | + testRuns TestRun[] |
| 17 | + projectId String |
| 18 | + project Project @relation(fields: [projectId], references: [id]) |
| 19 | + updatedAt DateTime @updatedAt |
| 20 | + createdAt DateTime @default(now()) |
| 21 | + user User? @relation(fields: [userId], references: [id]) |
| 22 | + userId String? |
| 23 | + isRunning Boolean? |
| 24 | +
|
| 25 | + @@unique([projectId, ciBuildId]) |
| 26 | +} |
| 27 | + |
| 28 | +model Project { |
| 29 | + id String @id @default(uuid()) |
| 30 | + name String |
| 31 | + mainBranchName String @default("master") |
| 32 | + builds Build[] |
| 33 | + buildsCounter Int @default(0) |
| 34 | + testVariations TestVariation[] |
| 35 | + updatedAt DateTime @updatedAt |
| 36 | + createdAt DateTime @default(now()) |
| 37 | +
|
| 38 | + @@unique([name]) |
| 39 | +} |
| 40 | + |
| 41 | +model TestRun { |
| 42 | + id String @id @default(uuid()) |
| 43 | + imageName String |
| 44 | + diffName String? |
| 45 | + diffPercent Float? |
| 46 | + diffTollerancePercent Float @default(0) |
| 47 | + pixelMisMatchCount Int? |
| 48 | + status TestStatus |
| 49 | + buildId String |
| 50 | + build Build @relation(fields: [buildId], references: [id]) |
| 51 | + testVariationId String? |
| 52 | + testVariation TestVariation? @relation(fields: [testVariationId], references: [id]) |
| 53 | + merge Boolean @default(false) |
| 54 | + updatedAt DateTime @updatedAt |
| 55 | + createdAt DateTime @default(now()) |
| 56 | + // Test variation data |
| 57 | + name String @default("") |
| 58 | + browser String? |
| 59 | + device String? |
| 60 | + os String? |
| 61 | + viewport String? |
| 62 | + baselineName String? |
| 63 | + comment String? |
| 64 | + baseline Baseline? |
| 65 | + branchName String @default("master") |
| 66 | + baselineBranchName String? |
| 67 | + ignoreAreas String @default("[]") |
| 68 | + tempIgnoreAreas String @default("[]") |
| 69 | +} |
| 70 | + |
| 71 | +model TestVariation { |
| 72 | + id String @id @default(uuid()) |
| 73 | + name String |
| 74 | + branchName String @default("master") |
| 75 | + browser String? |
| 76 | + device String? |
| 77 | + os String? |
| 78 | + viewport String? |
| 79 | + baselineName String? |
| 80 | + ignoreAreas String @default("[]") |
| 81 | + projectId String |
| 82 | + project Project @relation(fields: [projectId], references: [id]) |
| 83 | + testRuns TestRun[] |
| 84 | + baselines Baseline[] |
| 85 | + comment String? |
| 86 | + updatedAt DateTime @updatedAt |
| 87 | + createdAt DateTime @default(now()) |
| 88 | +
|
| 89 | + @@unique([projectId, name, browser, device, os, viewport, branchName]) |
| 90 | +} |
| 91 | + |
| 92 | +model Baseline { |
| 93 | + id String @id @default(uuid()) |
| 94 | + baselineName String |
| 95 | + testVariationId String |
| 96 | + testVariation TestVariation @relation(fields: [testVariationId], references: [id]) |
| 97 | + testRunId String? |
| 98 | + testRun TestRun? @relation(fields: [testRunId], references: [id]) |
| 99 | + updatedAt DateTime @updatedAt |
| 100 | + createdAt DateTime @default(now()) |
| 101 | +} |
| 102 | + |
| 103 | +model User { |
| 104 | + id String @id @default(uuid()) |
| 105 | + email String @unique |
| 106 | + password String |
| 107 | + firstName String? |
| 108 | + lastName String? |
| 109 | + apiKey String @unique |
| 110 | + isActive Boolean @default(true) |
| 111 | + builds Build[] |
| 112 | + updatedAt DateTime @updatedAt |
| 113 | + createdAt DateTime @default(now()) |
| 114 | +} |
| 115 | + |
| 116 | +enum TestStatus { |
| 117 | + failed |
| 118 | + new |
| 119 | + ok |
| 120 | + unresolved |
| 121 | + approved |
| 122 | + autoApproved |
| 123 | +} |
0 commit comments