|
| 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 | + maxBuildAllowed Int @default(100) |
| 35 | + maxBranchLifetime Int @default(30) |
| 36 | + testVariations TestVariation[] |
| 37 | + updatedAt DateTime @updatedAt |
| 38 | + createdAt DateTime @default(now()) |
| 39 | + // config |
| 40 | + autoApproveFeature Boolean @default(false) |
| 41 | + imageComparison ImageComparison @default(pixelmatch) |
| 42 | + imageComparisonConfig String @default("{ \"threshold\": 0.1, \"ignoreAntialiasing\": true, \"allowDiffDimensions\": false }") |
| 43 | +
|
| 44 | + TestRun TestRun[] |
| 45 | + @@unique([name]) |
| 46 | +} |
| 47 | + |
| 48 | +model TestRun { |
| 49 | + id String @id @default(uuid()) |
| 50 | + imageName String |
| 51 | + diffName String? |
| 52 | + diffPercent Float? |
| 53 | + diffTollerancePercent Float @default(0) |
| 54 | + pixelMisMatchCount Int? |
| 55 | + status TestStatus |
| 56 | + buildId String |
| 57 | + build Build @relation(fields: [buildId], references: [id]) |
| 58 | + testVariationId String? |
| 59 | + testVariation TestVariation? @relation(fields: [testVariationId], references: [id]) |
| 60 | + projectId String? |
| 61 | + project Project? @relation(fields: [projectId], references: [id]) |
| 62 | + merge Boolean @default(false) |
| 63 | + updatedAt DateTime @updatedAt |
| 64 | + createdAt DateTime @default(now()) |
| 65 | + // Test variation data |
| 66 | + name String @default("") |
| 67 | + browser String? |
| 68 | + device String? |
| 69 | + os String? |
| 70 | + viewport String? |
| 71 | + customTags String? @default("") |
| 72 | + baselineName String? |
| 73 | + comment String? |
| 74 | + baseline Baseline? |
| 75 | + branchName String @default("master") |
| 76 | + baselineBranchName String? |
| 77 | + ignoreAreas String @default("[]") |
| 78 | + tempIgnoreAreas String @default("[]") |
| 79 | +} |
| 80 | + |
| 81 | +model TestVariation { |
| 82 | + id String @id @default(uuid()) |
| 83 | + name String |
| 84 | + branchName String @default("master") |
| 85 | + browser String @default("") |
| 86 | + device String @default("") |
| 87 | + os String @default("") |
| 88 | + viewport String @default("") |
| 89 | + customTags String @default("") |
| 90 | + baselineName String? |
| 91 | + ignoreAreas String @default("[]") |
| 92 | + projectId String |
| 93 | + project Project @relation(fields: [projectId], references: [id]) |
| 94 | + testRuns TestRun[] |
| 95 | + baselines Baseline[] |
| 96 | + comment String? |
| 97 | + updatedAt DateTime @updatedAt |
| 98 | + createdAt DateTime @default(now()) |
| 99 | +
|
| 100 | + @@unique([projectId, name, browser, device, os, viewport, customTags, branchName]) |
| 101 | +} |
| 102 | + |
| 103 | +model Baseline { |
| 104 | + id String @id @default(uuid()) |
| 105 | + baselineName String |
| 106 | + testVariationId String |
| 107 | + testVariation TestVariation @relation(fields: [testVariationId], references: [id]) |
| 108 | + testRunId String? |
| 109 | + testRun TestRun? @relation(fields: [testRunId], references: [id]) |
| 110 | + userId String? |
| 111 | + user User? @relation(fields: [userId], references: [id]) |
| 112 | + updatedAt DateTime @updatedAt |
| 113 | + createdAt DateTime @default(now()) |
| 114 | +} |
| 115 | + |
| 116 | +model User { |
| 117 | + id String @id @default(uuid()) |
| 118 | + email String @unique |
| 119 | + password String |
| 120 | + firstName String? |
| 121 | + lastName String? |
| 122 | + apiKey String @unique |
| 123 | + isActive Boolean @default(true) |
| 124 | + builds Build[] |
| 125 | + baselines Baseline[] |
| 126 | + role Role @default(guest) |
| 127 | + updatedAt DateTime @updatedAt |
| 128 | + createdAt DateTime @default(now()) |
| 129 | +} |
| 130 | + |
| 131 | +enum TestStatus { |
| 132 | + failed |
| 133 | + new |
| 134 | + ok |
| 135 | + unresolved |
| 136 | + approved |
| 137 | + autoApproved |
| 138 | +} |
| 139 | + |
| 140 | +enum ImageComparison { |
| 141 | + pixelmatch |
| 142 | + lookSame |
| 143 | + odiff |
| 144 | +} |
| 145 | + |
| 146 | +enum Role { |
| 147 | + admin |
| 148 | + editor |
| 149 | + guest |
| 150 | +} |
0 commit comments