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
65 changes: 65 additions & 0 deletions prisma/migrations/20210517203552-add-custom-tags/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
# Migration `20210517203552-add-custom-tags`

This migration has been generated by Surat Das at 5/17/2021, 1:35:52 PM.
You can check out the [state of the schema](./schema.prisma) after the migration.

## Database Steps

```sql
DROP INDEX "TestVariation.projectId_name_browser_device_os_viewport_branchN"

ALTER TABLE "TestRun" ADD COLUMN "customTags" TEXT DEFAULT E''

ALTER TABLE "TestVariation" ADD COLUMN "customTags" TEXT NOT NULL DEFAULT E''

CREATE UNIQUE INDEX "TestVariation.projectId_name_browser_device_os_viewport_customTags_branchName_unique" ON "TestVariation"("projectId", "name", "browser", "device", "os", "viewport", "customTags", "branchName")
```

## Changes

```diff
diff --git schema.prisma schema.prisma
migration 20210425191116-github_215_project_config..20210517203552-add-custom-tags
--- datamodel.dml
+++ datamodel.dml
@@ -3,9 +3,9 @@
}
datasource db {
provider = "postgresql"
- url = "***"
+ url = "***"
}
model Build {
id String @id @default(uuid())
@@ -64,8 +64,9 @@
browser String?
device String?
os String?
viewport String?
+ customTags String? @default("")
baselineName String?
comment String?
baseline Baseline?
branchName String @default("master")
@@ -81,8 +82,9 @@
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])
@@ -91,9 +93,9 @@
comment String?
updatedAt DateTime @updatedAt
createdAt DateTime @default(now())
- @@unique([projectId, name, browser, device, os, viewport, branchName])
+ @@unique([projectId, name, browser, device, os, viewport, customTags, branchName])
}
model Baseline {
id String @id @default(uuid())
```


137 changes: 137 additions & 0 deletions prisma/migrations/20210517203552-add-custom-tags/schema.prisma
Original file line number Diff line number Diff line change
@@ -0,0 +1,137 @@
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)
testVariations TestVariation[]
updatedAt DateTime @updatedAt
createdAt DateTime @default(now())
// config
autoApproveFeature Boolean @default(false)
diffDimensionsFeature Boolean @default(false)
ignoreAntialiasing Boolean @default(true)
threshold Float @default(0.1)
imageComparison ImageComparison @default(pixelmatch)

@@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])
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[]
updatedAt DateTime @updatedAt
createdAt DateTime @default(now())
}

enum TestStatus {
failed
new
ok
unresolved
approved
autoApproved
}

enum ImageComparison {
pixelmatch
lookSame
odiff
}
101 changes: 101 additions & 0 deletions prisma/migrations/20210517203552-add-custom-tags/steps.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
{
"version": "0.3.14-fixed",
"steps": [
{
"tag": "CreateField",
"model": "TestRun",
"field": "customTags",
"type": "String",
"arity": "Optional"
},
{
"tag": "CreateDirective",
"location": {
"path": {
"tag": "Field",
"model": "TestRun",
"field": "customTags"
},
"directive": "default"
}
},
{
"tag": "CreateArgument",
"location": {
"tag": "Directive",
"path": {
"tag": "Field",
"model": "TestRun",
"field": "customTags"
},
"directive": "default"
},
"argument": "",
"value": "\"\""
},
{
"tag": "CreateField",
"model": "TestVariation",
"field": "customTags",
"type": "String",
"arity": "Required"
},
{
"tag": "CreateDirective",
"location": {
"path": {
"tag": "Field",
"model": "TestVariation",
"field": "customTags"
},
"directive": "default"
}
},
{
"tag": "CreateArgument",
"location": {
"tag": "Directive",
"path": {
"tag": "Field",
"model": "TestVariation",
"field": "customTags"
},
"directive": "default"
},
"argument": "",
"value": "\"\""
},
{
"tag": "CreateDirective",
"location": {
"path": {
"tag": "Model",
"model": "TestVariation",
"arguments": [
{
"name": "",
"value": "[projectId, name, browser, device, os, viewport, customTags, branchName]"
}
]
},
"directive": "unique"
}
},
{
"tag": "DeleteDirective",
"location": {
"path": {
"tag": "Model",
"model": "TestVariation",
"arguments": [
{
"name": "",
"value": "[projectId, name, browser, device, os, viewport, branchName]"
}
]
},
"directive": "unique"
}
}
]
}
3 changes: 2 additions & 1 deletion prisma/migrations/migrate.lock
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,5 @@
20210130115922-test-run-auto-approve-status-added
20210228121726-test-run--nullable-test-variation-id
20210405171118-github_243-set-empty-test-variation-tags-instead-of-null
20210425191116-github_215_project_config
20210425191116-github_215_project_config
20210517203552-add-custom-tags
4 changes: 3 additions & 1 deletion prisma/schema.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ model TestRun {
device String?
os String?
viewport String?
customTags String? @default("")
baselineName String?
comment String?
baseline Baseline?
Expand All @@ -82,6 +83,7 @@ model TestVariation {
device String @default("")
os String @default("")
viewport String @default("")
customTags String @default("")
baselineName String?
ignoreAreas String @default("[]")
projectId String
Expand All @@ -92,7 +94,7 @@ model TestVariation {
updatedAt DateTime @updatedAt
createdAt DateTime @default(now())

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

model Baseline {
Expand Down
2 changes: 2 additions & 0 deletions src/_data_/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ export const generateTestVariation = (
browser: 'browser',
viewport: 'viewport',
device: 'device',
customTags: '',
ignoreAreas: '[]',
comment: 'some comment',
createdAt: new Date(),
Expand Down Expand Up @@ -80,6 +81,7 @@ export const generateTestRun = (testRun?: Partial<TestRun>): TestRun => {
device: null,
os: null,
viewport: '1800x1600',
customTags: '',
baselineName: null,
ignoreAreas: '[]',
tempIgnoreAreas: '[]',
Expand Down
1 change: 1 addition & 0 deletions src/builds/builds.service.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ describe('BuildsService', () => {
device: null,
os: null,
viewport: '1800x1600',
customTags:'',
baselineName: null,
ignoreAreas: '[]',
tempIgnoreAreas: '[]',
Expand Down
Loading