Skip to content

Commit 49d6c1a

Browse files
committed
migration added
1 parent 05e4689 commit 49d6c1a

File tree

4 files changed

+197
-1
lines changed

4 files changed

+197
-1
lines changed
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# Migration `20200909223305-test-variation-project-id-added-into-unique-constraint`
2+
3+
This migration has been generated by Pavel Strunkin at 9/10/2020, 12:33:05 AM.
4+
You can check out the [state of the schema](./schema.prisma) after the migration.
5+
6+
## Database Steps
7+
8+
```sql
9+
DROP INDEX "public"."TestVariation.name_browser_device_os_viewport_branchName_unique"
10+
11+
CREATE UNIQUE INDEX "TestVariation.projectId_name_browser_device_os_viewport_branchName_unique" ON "public"."TestVariation"("projectId","name","browser","device","os","viewport","branchName")
12+
```
13+
14+
## Changes
15+
16+
```diff
17+
diff --git schema.prisma schema.prisma
18+
migration 20200812213545-build-run-status..20200909223305-test-variation-project-id-added-into-unique-constraint
19+
--- datamodel.dml
20+
+++ datamodel.dml
21+
@@ -3,9 +3,9 @@
22+
}
23+
datasource db {
24+
provider = "postgresql"
25+
- url = "***"
26+
+ url = "***"
27+
}
28+
model Build {
29+
id String @default(uuid()) @id
30+
@@ -80,9 +80,9 @@
31+
comment String?
32+
updatedAt DateTime @updatedAt
33+
createdAt DateTime @default(now())
34+
- @@unique([name, browser, device, os, viewport, branchName])
35+
+ @@unique([projectId, name, browser, device, os, viewport, branchName])
36+
}
37+
model Baseline {
38+
id String @default(uuid()) @id
39+
```
40+
41+
Lines changed: 117 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,117 @@
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+
isRunning Boolean?
23+
}
24+
25+
model Project {
26+
id String @default(uuid()) @id
27+
name String
28+
mainBranchName String @default("master")
29+
builds Build[]
30+
testVariations TestVariation[]
31+
updatedAt DateTime @updatedAt
32+
createdAt DateTime @default(now())
33+
34+
@@unique([name])
35+
}
36+
37+
model TestRun {
38+
id String @default(uuid()) @id
39+
imageName String
40+
diffName String?
41+
diffPercent Float?
42+
diffTollerancePercent Float @default(0)
43+
pixelMisMatchCount Int?
44+
status TestStatus
45+
buildId String
46+
build Build @relation(fields: [buildId], references: [id])
47+
testVariationId String
48+
testVariation TestVariation @relation(fields: [testVariationId], references: [id])
49+
merge Boolean @default(false)
50+
updatedAt DateTime @updatedAt
51+
createdAt DateTime @default(now())
52+
// Test variation data
53+
name String @default("")
54+
browser String?
55+
device String?
56+
os String?
57+
viewport String?
58+
baselineName String?
59+
ignoreAreas String @default("[]")
60+
comment String?
61+
baseline Baseline?
62+
branchName String @default("master")
63+
baselineBranchName String?
64+
}
65+
66+
model TestVariation {
67+
id String @default(uuid()) @id
68+
name String
69+
branchName String @default("master")
70+
browser String?
71+
device String?
72+
os String?
73+
viewport String?
74+
baselineName String?
75+
ignoreAreas String @default("[]")
76+
projectId String
77+
project Project @relation(fields: [projectId], references: [id])
78+
testRuns TestRun[]
79+
baselines Baseline[]
80+
comment String?
81+
updatedAt DateTime @updatedAt
82+
createdAt DateTime @default(now())
83+
84+
@@unique([projectId, name, browser, device, os, viewport, branchName])
85+
}
86+
87+
model Baseline {
88+
id String @default(uuid()) @id
89+
baselineName String
90+
testVariationId String
91+
testVariation TestVariation @relation(fields: [testVariationId], references: [id])
92+
testRunId String?
93+
testRun TestRun? @relation(fields: [testRunId], references: [id])
94+
updatedAt DateTime @updatedAt
95+
createdAt DateTime @default(now())
96+
}
97+
98+
model User {
99+
id String @default(uuid()) @id
100+
email String @unique
101+
password String
102+
firstName String?
103+
lastName String?
104+
apiKey String @unique
105+
isActive Boolean @default(true)
106+
builds Build[]
107+
updatedAt DateTime @updatedAt
108+
createdAt DateTime @default(now())
109+
}
110+
111+
enum TestStatus {
112+
failed
113+
new
114+
ok
115+
unresolved
116+
approved
117+
}
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
{
2+
"version": "0.3.14-fixed",
3+
"steps": [
4+
{
5+
"tag": "CreateDirective",
6+
"location": {
7+
"path": {
8+
"tag": "Model",
9+
"model": "TestVariation",
10+
"arguments": [
11+
{
12+
"name": "",
13+
"value": "[projectId, name, browser, device, os, viewport, branchName]"
14+
}
15+
]
16+
},
17+
"directive": "unique"
18+
}
19+
},
20+
{
21+
"tag": "DeleteDirective",
22+
"location": {
23+
"path": {
24+
"tag": "Model",
25+
"model": "TestVariation",
26+
"arguments": [
27+
{
28+
"name": "",
29+
"value": "[name, browser, device, os, viewport, branchName]"
30+
}
31+
]
32+
},
33+
"directive": "unique"
34+
}
35+
}
36+
]
37+
}

prisma/migrations/migrate.lock

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,5 @@
77
20200707182652-project-name-unique-constraint
88
20200715232608-branch-strategy
99
20200728221159-zero-diff-tolerance
10-
20200812213545-build-run-status
10+
20200812213545-build-run-status
11+
20200909223305-test-variation-project-id-added-into-unique-constraint

0 commit comments

Comments
 (0)