Skip to content

Commit 63a81b6

Browse files
paazmayapashidlos
andauthored
Prisma upgrade (#206)
* Upgrade Prisma to last of major 3 #200 * Format all schemas with Prisma format * Preview feature "atomicNumberOperations" is deprecated. The functionality can be used without specifying it as a preview feature. * Update dependencies also in prisma folder * Types complain * Raw query needs to be a template now * Update documentation * Another round of running prisma format against all schemas * Use same types as elsewhere in the same file * Moving to Prisma 4.0.0 * Going to Prisma v5 which came out like 20 hours ago.. * Remove previous migrations and update import path for generated client * Update lock file * Update prisma folder package to match the root more closely * Works locally until docker-compose... * Same image versions as frontend currently uses * Prisma deploy instead of dev * fix e2e tests (#212) * fix e2e tests * migration added * manual migration are obsolete witn new DB schema * Let me try PostgreSQL v14 * Just had to try with the predefined server info for pgadmin --------- Co-authored-by: Juga Paazmaya <[email protected]> * 200 fix migration (#213) --------- Co-authored-by: Pavel Strunkin <[email protected]>
1 parent 0b6d92e commit 63a81b6

File tree

95 files changed

+690
-7249
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

95 files changed

+690
-7249
lines changed

.github/workflows/workflow.yml

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,22 +5,19 @@ on: [push]
55
jobs:
66
build:
77
# https://github.com/actions/runner-images#available-images
8-
runs-on: ubuntu-20.04
8+
runs-on: ubuntu-22.04
99

1010
steps:
1111
- uses: actions/checkout@v3
1212

1313
- name: Setup Node.js environment
1414
uses: actions/setup-node@v3
1515
with:
16-
node-version: '14.16.1'
16+
node-version: '18'
1717

1818
- name: Install npm dependencies
1919
run: npm ci
2020

21-
- name: Prisma generate
22-
run: npm run prisma:generate
23-
2421
- name: Unit tests
2522
run: npm run test:cov
2623

Dockerfile

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,24 @@
11
# https://github.com/Visual-Regression-Tracker/Visual-Regression-Tracker/issues/137
2-
FROM node:14-alpine3.17 AS builder
2+
FROM node:18-alpine3.18 AS builder
33

44
# Create app directory
55
WORKDIR /app
66

7-
RUN npm install -g @prisma/[email protected] --unsafe-perm
8-
97
COPY ./prisma/schema.prisma ./
108

119
# A wildcard is used to ensure both package.json AND package-lock.json are copied
1210
COPY package*.json ./
1311

1412
# Install app dependencies
15-
RUN npm install
13+
RUN npm ci --verbose
1614

1715
COPY tsconfig*.json ./
1816
COPY src ./src
1917

2018
RUN npm run build
2119

2220
# https://github.com/Visual-Regression-Tracker/Visual-Regression-Tracker/issues/137
23-
FROM node:14-alpine3.17
21+
FROM node:18-alpine3.18
2422
COPY --from=builder /app/node_modules ./node_modules
2523
COPY --from=builder /app/package*.json ./
2624
COPY --from=builder /app/dist ./dist

README.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,13 @@
88
- Install Node `14`
99
- clone repo
1010
- Update `.env` and `prisma/.env`
11-
- Make sure Postgres is up and running
11+
- Make sure Postgres is up and running, using `docker-compose up` in a separate terminal
1212
- `npm i`
1313
- `npm run test`
14-
- Create DB structure and apply migrations `npx prisma migrate up -c --experimental`
14+
- Create DB structure `npx prisma db push`
15+
- Apply migrations `npx prisma migrate deploy`
1516
- `npm run test:e2e`
16-
- Seed initial data `npx ts-node prisma/seed.ts`
17+
- Seed initial data `npx prisma db seed`
1718
- `npm run start:debug`
1819

1920
## Local HTTPS config

docker-compose.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ services:
2828
- postgres
2929
postgres:
3030
container_name: postgres
31-
image: postgres:12-alpine3.18
31+
image: postgres:15.3-alpine3.18
3232
restart: always
3333
environment:
3434
POSTGRES_USER: ${POSTGRES_USER}
@@ -40,9 +40,13 @@ services:
4040
- "${POSTGRES_PORT}"
4141
volumes:
4242
- postgres:/var/lib/postgresql/data
43+
44+
# Available at http://localhost:5050
4345
pgadmin:
4446
container_name: pgadmin4
45-
image: dpage/pgadmin4
47+
# https://hub.docker.com/r/dpage/pgadmin4
48+
# https://www.pgadmin.org/docs/pgadmin4/latest/release_notes_7_4.html
49+
image: dpage/pgadmin4:7.4
4650
restart: always
4751
environment:
4852
PGADMIN_DEFAULT_EMAIL: [email protected]

package-lock.json

Lines changed: 61 additions & 74 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
"start:dev": "nest start --watch",
1414
"start:debug": "nest start --debug --watch",
1515
"start:prod": "node dist/main",
16-
"prisma:generate": "prisma generate",
1716
"lint": "eslint \"{src,apps,libs,test}/**/*.ts\" --fix",
1817
"test": "jest --projects src",
1918
"test:watch": "jest --projects src --watch",
@@ -22,6 +21,9 @@
2221
"test:e2e": "jest --projects test",
2322
"test:acceptance": "jest --projects test_acceptance"
2423
},
24+
"engines": {
25+
"node": ">=16.13.0"
26+
},
2527
"dependencies": {
2628
"@nestjs/common": "^8.4.1",
2729
"@nestjs/config": "^1.2.0",
@@ -34,7 +36,7 @@
3436
"@nestjs/swagger": "^5.2.0",
3537
"@nestjs/terminus": "^8.0.8",
3638
"@nestjs/websockets": "^8.4.1",
37-
"@prisma/client": "2.12.1",
39+
"@prisma/client": "^5.0.0",
3840
"ajv": "^8.10.0",
3941
"bcryptjs": "^2.4.3",
4042
"cache-manager": "^3.6.0",
@@ -60,7 +62,6 @@
6062
"@nestjs/cli": "^8.2.3",
6163
"@nestjs/schematics": "^8.0.8",
6264
"@nestjs/testing": "^8.4.1",
63-
"@prisma/cli": "2.12.1",
6465
"@types/bcryptjs": "^2.4.2",
6566
"@types/cache-manager": "^3.4.3",
6667
"@types/cron": "^1.7.3",
@@ -82,11 +83,15 @@
8283
"eslint-plugin-import": "^2.25.4",
8384
"jest": "^27.5.1",
8485
"prettier": "^2.6.0",
86+
"prisma": "^5.0.0",
8587
"supertest": "^6.2.2",
8688
"ts-jest": "^27.1.3",
8789
"ts-loader": "^9.2.8",
8890
"ts-node": "^10.7.0",
8991
"tsconfig-paths": "^3.14.0",
90-
"typescript": "^4.6.2"
92+
"typescript": "^4.9.2"
93+
},
94+
"prisma": {
95+
"seed": "ts-node prisma/seed.ts"
9196
}
9297
}

prisma/Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
# https://github.com/Visual-Regression-Tracker/Visual-Regression-Tracker/issues/137
2-
FROM node:14-alpine3.17
2+
FROM node:18-alpine3.18
33

44
RUN apk add --no-cache bash
55

66
WORKDIR /app
77

88
COPY . .
99

10-
RUN npm ci
10+
RUN npm ci --verbose
1111

1212
RUN chmod +x /app/wait-for-it.sh
1313
RUN chmod +x /app/entrypoint.sh

0 commit comments

Comments
 (0)