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
58 changes: 58 additions & 0 deletions prisma/migrations/20200627134248-comment-added/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# Migration `20200627134248-comment-added`

This migration has been generated by Pavel Strunkin at 6/27/2020, 1:42:48 PM.
You can check out the [state of the schema](./schema.prisma) after the migration.

## Database Steps

```sql
ALTER TABLE "public"."TestRun" ADD COLUMN "comment" text ;

ALTER TABLE "public"."TestVariation" ADD COLUMN "comment" text ;
```

## Changes

```diff
diff --git schema.prisma schema.prisma
migration 20200526195312-approved-test-status-added..20200627134248-comment-added
--- datamodel.dml
+++ datamodel.dml
@@ -3,9 +3,9 @@
}
datasource db {
provider = "postgresql"
- url = "***"
+ url = env("DATABASE_URL")
}
model Build {
id String @default(uuid()) @id
@@ -51,9 +51,9 @@
os String?
viewport String?
baselineName String?
ignoreAreas String @default("[]")
- // Baseline
+ comment String?
baseline Baseline?
}
model TestVariation {
@@ -68,8 +68,9 @@
projectId String
project Project @relation(fields: [projectId], references: [id])
testRuns TestRun[]
baselines Baseline[]
+ comment String?
updatedAt DateTime @updatedAt
createdAt DateTime @default(now())
}
@@ -102,5 +103,5 @@
new
ok
unresolved
approved
-}
+}
```


107 changes: 107 additions & 0 deletions prisma/migrations/20200627134248-comment-added/schema.prisma
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
generator client {
provider = "prisma-client-js"
}

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

model Build {
id String @default(uuid()) @id
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?
}

model Project {
id String @default(uuid()) @id
name String
builds Build[]
testVariations TestVariation[]
updatedAt DateTime @updatedAt
createdAt DateTime @default(now())
}

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

model TestVariation {
id String @default(uuid()) @id
name String
browser String?
device String?
os String?
viewport String?
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())
}

model Baseline {
id String @default(uuid()) @id
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 @default(uuid()) @id
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
}
19 changes: 19 additions & 0 deletions prisma/migrations/20200627134248-comment-added/steps.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"version": "0.3.14-fixed",
"steps": [
{
"tag": "CreateField",
"model": "TestRun",
"field": "comment",
"type": "String",
"arity": "Optional"
},
{
"tag": "CreateField",
"model": "TestVariation",
"field": "comment",
"type": "String",
"arity": "Optional"
}
]
}
6 changes: 2 additions & 4 deletions prisma/migrations/migrate.lock
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
# IF THERE'S A GIT CONFLICT IN THIS FILE, DON'T SOLVE IT MANUALLY!
# INSTEAD EXECUTE `prisma migrate fix`
# Prisma Migrate lockfile v1
# Read more about conflict resolution here: TODO

20200503001556-init
20200524162125-baseline-history
20200526195312-approved-test-status-added
20200526195312-approved-test-status-added
20200627134248-comment-added
2 changes: 1 addition & 1 deletion prisma/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "vrt-migration",
"version": "1.1.3",
"version": "1.2.0",
"description": "",
"author": "",
"private": true,
Expand Down
5 changes: 3 additions & 2 deletions prisma/schema.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ model TestRun {
viewport String?
baselineName String?
ignoreAreas String @default("[]")
// Baseline
comment String?
baseline Baseline?
}

Expand All @@ -69,6 +69,7 @@ model TestVariation {
project Project @relation(fields: [projectId], references: [id])
testRuns TestRun[]
baselines Baseline[]
comment String?
updatedAt DateTime @updatedAt
createdAt DateTime @default(now())
}
Expand Down Expand Up @@ -103,4 +104,4 @@ enum TestStatus {
ok
unresolved
approved
}
}
1 change: 1 addition & 0 deletions src/builds/builds.service.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ describe('BuildsService', () => {
viewport: '1800x1600',
baselineName: null,
ignoreAreas: '[]',
comment: 'some comment',
},
],
};
Expand Down
14 changes: 13 additions & 1 deletion src/builds/dto/build.dto.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,9 @@ describe('BuildDto', () => {
});

it('passed', () => {
const build = {
const build: Build & {
testRuns: TestRun[];
} = {
id: 'a9385fc1-884d-4f9f-915e-40da0e7773d5',
number: null,
branchName: 'develop',
Expand Down Expand Up @@ -82,6 +84,7 @@ describe('BuildDto', () => {
viewport: '1800x1600',
baselineName: null,
ignoreAreas: '[]',
comment: 'some comment1',
},
{
id: '10fb5e02-64e0-4cf5-9f17-c00ab3c96658',
Expand All @@ -102,6 +105,7 @@ describe('BuildDto', () => {
viewport: '1800x1600',
baselineName: null,
ignoreAreas: '[]',
comment: 'some comment2',
},
],
};
Expand Down Expand Up @@ -154,6 +158,7 @@ describe('BuildDto', () => {
viewport: '1800x1600',
baselineName: null,
ignoreAreas: '[]',
comment: 'some comment',
},
{
id: '10fb5e02-64e0-4cf5-9f17-c00ab3c96658',
Expand All @@ -174,6 +179,7 @@ describe('BuildDto', () => {
viewport: '1800x1600',
baselineName: null,
ignoreAreas: '[]',
comment: 'some comment1',
},
{
id: '10fb5e02-64e0-4cf5-9f17-c00ab3c96658',
Expand All @@ -194,6 +200,7 @@ describe('BuildDto', () => {
viewport: '1800x1600',
baselineName: null,
ignoreAreas: '[]',
comment: 'some comment2',
},
],
};
Expand Down Expand Up @@ -246,6 +253,7 @@ describe('BuildDto', () => {
viewport: '1800x1600',
baselineName: null,
ignoreAreas: '[]',
comment: 'some comment1',
},
{
id: '10fb5e02-64e0-4cf5-9f17-c00ab3c96658',
Expand All @@ -266,6 +274,7 @@ describe('BuildDto', () => {
viewport: '1800x1600',
baselineName: null,
ignoreAreas: '[]',
comment: 'some comment2',
},
{
id: '10fb5e02-64e0-4cf5-9f17-c00ab3c96658',
Expand All @@ -286,6 +295,7 @@ describe('BuildDto', () => {
viewport: '1800x1600',
baselineName: null,
ignoreAreas: '[]',
comment: null,
},
{
id: '10fb5e02-64e0-4cf5-9f17-c00ab3c96658',
Expand All @@ -306,6 +316,7 @@ describe('BuildDto', () => {
viewport: '1800x1600',
baselineName: null,
ignoreAreas: '[]',
comment: 'some comment',
},
{
id: '10fb5e02-64e0-4cf5-9f17-c00ab3c96658',
Expand All @@ -326,6 +337,7 @@ describe('BuildDto', () => {
viewport: '1800x1600',
baselineName: null,
ignoreAreas: '[]',
comment: 'some comment',
},
],
};
Expand Down
8 changes: 8 additions & 0 deletions src/shared/dto/comment.dto.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { ApiProperty } from '@nestjs/swagger';
import { IsString } from 'class-validator';

export class CommentDto {
@ApiProperty()
@IsString()
comment: string;
}
Loading