Skip to content

Commit

Permalink
Change seeding method of test-db
Browse files Browse the repository at this point in the history
- Change included_in_block_timestamp field type in test-schema.prisma from BigInt to Decimal as in the original schema
to reflect same properties.
- Remove Synth script in package.json test script and add seed script to populate Prisma test db using Prisma's seeding option.
- This change is made due to the bug in generating numeric data in Synth:
shuttle-hq/synth#272
- Add ts-node as dev dependency to be able to use Prisma seed
- Change test file name to a more descriptive name.
  • Loading branch information
eadsoy committed Mar 8, 2022
1 parent 5605005 commit 760259c
Show file tree
Hide file tree
Showing 6 changed files with 402 additions and 11 deletions.
File renamed without changes.
232 changes: 232 additions & 0 deletions web-app/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 8 additions & 2 deletions web-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,20 @@
"name": "nextplus",
"version": "0.1.0",
"private": true,
"prisma": {
"seed": "ts-node --compiler-options {\"module\":\"CommonJS\"} prisma/seed.ts"
},
"scripts": {
"dev": "next dev",
"build": "next build",
"start": "next start",
"lint": "next lint",
"docker:up": "docker-compose up -d",
"docker:down": "docker-compose down",
"test": "yarn docker:up && yarn migrate:postgres deploy && synth generate synth/test_db --to postgresql://prisma:prisma@localhost:5433/tests | jq . && dotenv -e .env.test jest -i",
"migrate:postgres": "dotenv -e .env.test -- npx prisma migrate dev --schema ./prisma/test-schema.prisma --name postgres-init"
"test": "yarn docker:up && yarn migrate:postgres deploy && yarn db:seed && dotenv -e .env.test jest -i ",
"migrate:postgres": "dotenv -e .env.test -- npx prisma migrate dev --schema ./prisma/test-schema.prisma --name postgres-init --skip-seed",
"migrate:reset": "dotenv -e .env.test -- npx prisma migrate reset --schema ./prisma/test-schema.prisma",
"db:seed": "dotenv -e .env.test -- npx prisma db seed"
},
"dependencies": {
"@fortawesome/fontawesome-svg-core": "^1.3.0",
Expand Down Expand Up @@ -43,6 +48,7 @@
"sass": "^1.43.5",
"tailwindcss": "^3.0.16",
"ts-jest": "^27.1.3",
"ts-node": "^10.7.0",
"typescript": "^4.6.2"
}
}
Loading

0 comments on commit 760259c

Please sign in to comment.