Skip to content

Commit

Permalink
fix(be): cannot seed db (#595)
Browse files Browse the repository at this point in the history
* test: perform prisma migration

* fix: swc-node is not available

* fix(ci): add force option  for prima migrate
  • Loading branch information
dotoleeoak authored Jul 3, 2023
1 parent a0a673d commit 201278e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
10 changes: 6 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,9 @@ jobs:
test:
runs-on: ${{ matrix.os }}

env:
DATABASE_URL: postgresql://postgres:1234@localhost:5432/skkuding?schema=public

strategy:
matrix:
os: [ubuntu-latest]
Expand Down Expand Up @@ -106,21 +109,20 @@ jobs:
run: pnpm --filter backend exec prisma generate

- name: Check Prisma Migration
env:
DATABASE_URL: postgresql://postgres:[email protected]:5432/skkuding?schema=public
run: |
pnpm --filter backend exec prisma migrate diff \
--from-migrations ./prisma/migrations \
--to-schema-datamodel ./prisma/schema.prisma \
--shadow-database-url postgresql://postgres:[email protected]:5432/skkuding?schema=public \
--exit-code
- name: Migrate Prisma
run: pnpm --filter backend exec prisma migrate reset --force

- name: Check types in Typescript
run: pnpm --filter backend exec tsc --noEmit

- name: Test
run: pnpm -r test
env:
DATABASE_URL: postgresql://postgres:1234@localhost:5432/skkuding?schema=public

# TODO: deploy
2 changes: 1 addition & 1 deletion backend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,6 @@
"typescript": "^5.1.6"
},
"prisma": {
"seed": "swc-node prisma/seed.ts"
"seed": "ts-node prisma/seed.ts"
}
}

0 comments on commit 201278e

Please sign in to comment.