Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
"@nestjs/passport": "^7.1.0",
"@nestjs/platform-express": "^7.4.2",
"@nestjs/platform-socket.io": "^7.6.17",
"@nestjs/schedule": "^0.4.3",
"@nestjs/swagger": "^4.8.0",
"@nestjs/websockets": "^7.4.2",
"@prisma/client": "2.12.1",
Expand Down Expand Up @@ -58,6 +59,7 @@
"@prisma/cli": "2.12.1",
"@types/bcryptjs": "^2.4.2",
"@types/cache-manager": "^2.10.3",
"@types/cron": "^1.7.2",
"@types/express": "^4.17.7",
"@types/jest": "26.0.14",
"@types/lodash": "^4.14.168",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
# Migration `20210709115233-gh-275-max-branch-lifetime`

This migration has been generated by Pavel Strunkin at 7/9/2021, 2:52:33 PM.
You can check out the [state of the schema](./schema.prisma) after the migration.

## Database Steps

```sql
ALTER TABLE "Baseline" ADD COLUMN "userId" TEXT

ALTER TABLE "Project" ADD COLUMN "maxBranchLifetime" INTEGER NOT NULL DEFAULT 30

ALTER TABLE "Baseline" ADD FOREIGN KEY("userId")REFERENCES "User"("id") ON DELETE SET NULL ON UPDATE CASCADE
```

## Changes

```diff
diff --git schema.prisma schema.prisma
migration 20210705154453-baseline-author..20210709115233-gh-275-max-branch-lifetime
--- datamodel.dml
+++ datamodel.dml
@@ -3,9 +3,9 @@
}
datasource db {
provider = "postgresql"
- url = "***"
+ url = "***"
}
model Build {
id String @id @default(uuid())
@@ -31,8 +31,9 @@
mainBranchName String @default("master")
builds Build[]
buildsCounter Int @default(0)
maxBuildAllowed Int @default(100)
+ maxBranchLifetime Int @default(30)
testVariations TestVariation[]
updatedAt DateTime @updatedAt
createdAt DateTime @default(now())
// config
@@ -104,24 +105,24 @@
testRunId String?
testRun TestRun? @relation(fields: [testRunId], references: [id])
userId String?
user User? @relation(fields: [userId], references: [id])
- updatedAt DateTime @updatedAt
+ updatedAt DateTime @updatedAt
createdAt DateTime @default(now())
}
model User {
- id String @id @default(uuid())
- email String @unique
+ id String @id @default(uuid())
+ email String @unique
password String
firstName String?
lastName String?
- apiKey String @unique
- isActive Boolean @default(true)
+ apiKey String @unique
+ isActive Boolean @default(true)
builds Build[]
baselines Baseline[]
- updatedAt DateTime @updatedAt
- createdAt DateTime @default(now())
+ updatedAt DateTime @updatedAt
+ createdAt DateTime @default(now())
}
enum TestStatus {
failed
```


Original file line number Diff line number Diff line change
@@ -0,0 +1,140 @@
generator client {
provider = "prisma-client-js"
}

datasource db {
provider = "postgresql"
url = "***"
}

model Build {
id String @id @default(uuid())
ciBuildId String?
number Int?
branchName String?
status String?
testRuns TestRun[]
projectId String
project Project @relation(fields: [projectId], references: [id])
updatedAt DateTime @updatedAt
createdAt DateTime @default(now())
user User? @relation(fields: [userId], references: [id])
userId String?
isRunning Boolean?

@@unique([projectId, ciBuildId])
}

model Project {
id String @id @default(uuid())
name String
mainBranchName String @default("master")
builds Build[]
buildsCounter Int @default(0)
maxBuildAllowed Int @default(100)
maxBranchLifetime Int @default(30)
testVariations TestVariation[]
updatedAt DateTime @updatedAt
createdAt DateTime @default(now())
// config
autoApproveFeature Boolean @default(false)
imageComparison ImageComparison @default(pixelmatch)
imageComparisonConfig String @default("{ \"threshold\": 0.1, \"ignoreAntialiasing\": true, \"allowDiffDimensions\": false }")

@@unique([name])
}

model TestRun {
id String @id @default(uuid())
imageName String
diffName String?
diffPercent Float?
diffTollerancePercent Float @default(0)
pixelMisMatchCount Int?
status TestStatus
buildId String
build Build @relation(fields: [buildId], references: [id])
testVariationId String?
testVariation TestVariation? @relation(fields: [testVariationId], references: [id])
merge Boolean @default(false)
updatedAt DateTime @updatedAt
createdAt DateTime @default(now())
// Test variation data
name String @default("")
browser String?
device String?
os String?
viewport String?
customTags String? @default("")
baselineName String?
comment String?
baseline Baseline?
branchName String @default("master")
baselineBranchName String?
ignoreAreas String @default("[]")
tempIgnoreAreas String @default("[]")
}

model TestVariation {
id String @id @default(uuid())
name String
branchName String @default("master")
browser String @default("")
device String @default("")
os String @default("")
viewport String @default("")
customTags String @default("")
baselineName String?
ignoreAreas String @default("[]")
projectId String
project Project @relation(fields: [projectId], references: [id])
testRuns TestRun[]
baselines Baseline[]
comment String?
updatedAt DateTime @updatedAt
createdAt DateTime @default(now())

@@unique([projectId, name, browser, device, os, viewport, customTags, branchName])
}

model Baseline {
id String @id @default(uuid())
baselineName String
testVariationId String
testVariation TestVariation @relation(fields: [testVariationId], references: [id])
testRunId String?
testRun TestRun? @relation(fields: [testRunId], references: [id])
userId String?
user User? @relation(fields: [userId], references: [id])
updatedAt DateTime @updatedAt
createdAt DateTime @default(now())
}

model User {
id String @id @default(uuid())
email String @unique
password String
firstName String?
lastName String?
apiKey String @unique
isActive Boolean @default(true)
builds Build[]
baselines Baseline[]
updatedAt DateTime @updatedAt
createdAt DateTime @default(now())
}

enum TestStatus {
failed
new
ok
unresolved
approved
autoApproved
}

enum ImageComparison {
pixelmatch
lookSame
odiff
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
{
"version": "0.3.14-fixed",
"steps": [
{
"tag": "CreateField",
"model": "Project",
"field": "maxBranchLifetime",
"type": "Int",
"arity": "Required"
},
{
"tag": "CreateDirective",
"location": {
"path": {
"tag": "Field",
"model": "Project",
"field": "maxBranchLifetime"
},
"directive": "default"
}
},
{
"tag": "CreateArgument",
"location": {
"tag": "Directive",
"path": {
"tag": "Field",
"model": "Project",
"field": "maxBranchLifetime"
},
"directive": "default"
},
"argument": "",
"value": "30"
}
]
}
3 changes: 2 additions & 1 deletion prisma/migrations/migrate.lock
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,5 @@
20210517203552-add-custom-tags
20210605124856-image-compare-config-as-json
20210612140950-limit-build-number
20210705154453-baseline-author
20210705154453-baseline-author
20210709115233-gh-275-max-branch-lifetime
15 changes: 8 additions & 7 deletions prisma/schema.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ model Project {
builds Build[]
buildsCounter Int @default(0)
maxBuildAllowed Int @default(100)
maxBranchLifetime Int @default(30)
testVariations TestVariation[]
updatedAt DateTime @updatedAt
createdAt DateTime @default(now())
Expand Down Expand Up @@ -105,22 +106,22 @@ model Baseline {
testRun TestRun? @relation(fields: [testRunId], references: [id])
userId String?
user User? @relation(fields: [userId], references: [id])
updatedAt DateTime @updatedAt
updatedAt DateTime @updatedAt
createdAt DateTime @default(now())
}

model User {
id String @id @default(uuid())
email String @unique
id String @id @default(uuid())
email String @unique
password String
firstName String?
lastName String?
apiKey String @unique
isActive Boolean @default(true)
apiKey String @unique
isActive Boolean @default(true)
builds Build[]
baselines Baseline[]
updatedAt DateTime @updatedAt
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
createdAt DateTime @default(now())
}

enum TestStatus {
Expand Down
1 change: 1 addition & 0 deletions src/_data_/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ export const TEST_PROJECT: Project = {
name: 'Test Project',
buildsCounter: 2,
maxBuildAllowed: 100,
maxBranchLifetime: 30,
mainBranchName: 'master',
createdAt: new Date(),
updatedAt: new Date(),
Expand Down
Loading