Skip to content

Commit 603e1a8

Browse files
committed
baseline history populated on approve
1 parent d45c845 commit 603e1a8

File tree

10 files changed

+618
-11
lines changed

10 files changed

+618
-11
lines changed

.vscode/launch.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@
44
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
55
"version": "0.2.0",
66
"configurations": [
7-
8-
97
{
108
"type": "node",
119
"request": "attach",
12-
"name": "Attach by Process ID",
10+
"name": "Attach NestJS WS",
1311
"port": 9229,
14-
"processId": "${command:PickProcess}"
15-
},
12+
"restart": true,
13+
"stopOnEntry": false,
14+
"protocol": "inspector"
15+
}
1616
]
1717
}
Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
# Migration `20200524122552-baseline-history`
2+
3+
This migration has been generated by Pavel Strunkin at 5/24/2020, 12:25:52 PM.
4+
You can check out the [state of the schema](./schema.prisma) after the migration.
5+
6+
## Database Steps
7+
8+
```sql
9+
CREATE TABLE "public"."Baseline" (
10+
"baselineName" text NOT NULL ,"createdAt" timestamp(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,"id" text NOT NULL ,"testRunId" text NOT NULL ,"testVariationId" text NOT NULL ,"updatedAt" timestamp(3) NOT NULL ,
11+
PRIMARY KEY ("id"))
12+
13+
CREATE UNIQUE INDEX "Baseline_testRunId" ON "public"."Baseline"("testRunId")
14+
15+
ALTER TABLE "public"."Baseline" ADD FOREIGN KEY ("testVariationId")REFERENCES "public"."TestVariation"("id") ON DELETE CASCADE ON UPDATE CASCADE
16+
17+
ALTER TABLE "public"."Baseline" ADD FOREIGN KEY ("testRunId")REFERENCES "public"."TestRun"("id") ON DELETE CASCADE ON UPDATE CASCADE
18+
```
19+
20+
## Changes
21+
22+
```diff
23+
diff --git schema.prisma schema.prisma
24+
migration 20200523130656-test-run-owns-variation-data..20200524122552-baseline-history
25+
--- datamodel.dml
26+
+++ datamodel.dml
27+
@@ -3,9 +3,9 @@
28+
}
29+
datasource db {
30+
provider = "postgresql"
31+
- url = "***"
32+
+ url = env("DATABASE_URL")
33+
}
34+
model Build {
35+
id String @default(uuid()) @id
36+
@@ -51,26 +51,40 @@
37+
os String?
38+
viewport String?
39+
baselineName String?
40+
ignoreAreas String @default("[]")
41+
+ // Baseline
42+
+ baseline Baseline
43+
}
44+
model TestVariation {
45+
- id String @default(uuid()) @id
46+
+ id String @default(uuid()) @id
47+
name String
48+
browser String?
49+
device String?
50+
os String?
51+
viewport String?
52+
baselineName String?
53+
- ignoreAreas String @default("[]")
54+
+ ignoreAreas String @default("[]")
55+
projectId String
56+
- project Project @relation(fields: [projectId], references: [id])
57+
+ project Project @relation(fields: [projectId], references: [id])
58+
testRuns TestRun[]
59+
- updatedAt DateTime @updatedAt
60+
- createdAt DateTime @default(now())
61+
+ baselines Baseline[]
62+
+ updatedAt DateTime @updatedAt
63+
+ createdAt DateTime @default(now())
64+
}
65+
+model Baseline {
66+
+ id String @default(uuid()) @id
67+
+ baselineName String
68+
+ updatedAt DateTime @updatedAt
69+
+ createdAt DateTime @default(now())
70+
+ testVariation TestVariation @relation(fields: [testVariationId], references: [id])
71+
+ testVariationId String
72+
+ testRunId String
73+
+ testRun TestRun @relation(fields: [testRunId], references: [id])
74+
+}
75+
+
76+
model User {
77+
id String @default(uuid()) @id
78+
email String @unique
79+
password String
80+
```
81+
82+
Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
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 @default(uuid()) @id
12+
number Int?
13+
branchName String?
14+
status String?
15+
testRuns TestRun[]
16+
projectId String
17+
project Project @relation(fields: [projectId], references: [id])
18+
updatedAt DateTime @updatedAt
19+
createdAt DateTime @default(now())
20+
user User? @relation(fields: [userId], references: [id])
21+
userId String?
22+
}
23+
24+
model Project {
25+
id String @default(uuid()) @id
26+
name String
27+
builds Build[]
28+
testVariations TestVariation[]
29+
updatedAt DateTime @updatedAt
30+
createdAt DateTime @default(now())
31+
}
32+
33+
model TestRun {
34+
id String @default(uuid()) @id
35+
imageName String
36+
diffName String?
37+
diffPercent Float?
38+
diffTollerancePercent Float @default(1.0)
39+
pixelMisMatchCount Int?
40+
status TestStatus
41+
buildId String
42+
build Build @relation(fields: [buildId], references: [id])
43+
testVariationId String
44+
testVariation TestVariation @relation(fields: [testVariationId], references: [id])
45+
updatedAt DateTime @updatedAt
46+
createdAt DateTime @default(now())
47+
// Test variation data
48+
name String @default("")
49+
browser String?
50+
device String?
51+
os String?
52+
viewport String?
53+
baselineName String?
54+
ignoreAreas String @default("[]")
55+
// Baseline
56+
baseline Baseline
57+
}
58+
59+
model TestVariation {
60+
id String @default(uuid()) @id
61+
name String
62+
browser String?
63+
device String?
64+
os String?
65+
viewport String?
66+
baselineName String?
67+
ignoreAreas String @default("[]")
68+
projectId String
69+
project Project @relation(fields: [projectId], references: [id])
70+
testRuns TestRun[]
71+
baselines Baseline[]
72+
updatedAt DateTime @updatedAt
73+
createdAt DateTime @default(now())
74+
}
75+
76+
model Baseline {
77+
id String @default(uuid()) @id
78+
baselineName String
79+
updatedAt DateTime @updatedAt
80+
createdAt DateTime @default(now())
81+
testVariation TestVariation @relation(fields: [testVariationId], references: [id])
82+
testVariationId String
83+
testRunId String
84+
testRun TestRun @relation(fields: [testRunId], references: [id])
85+
}
86+
87+
model User {
88+
id String @default(uuid()) @id
89+
email String @unique
90+
password String
91+
firstName String?
92+
lastName String?
93+
apiKey String @unique
94+
isActive Boolean @default(true)
95+
builds Build[]
96+
updatedAt DateTime @updatedAt
97+
createdAt DateTime @default(now())
98+
}
99+
100+
enum TestStatus {
101+
failed
102+
new
103+
ok
104+
unresolved
105+
}

0 commit comments

Comments
 (0)