Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: migrate from supabase to postgresql #129

Merged
merged 6 commits into from
Feb 9, 2024
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
3 changes: 2 additions & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
node_modules/
node_modules/
data/
7 changes: 2 additions & 5 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
DATABASE_URL=postgres://postgres:{PASSWORD}@{HOST}:5432/postgres
SUPABASE_API_URL=https://<your-project-name>.supabase.co
SUPABASE_ANON_KEY=
[email protected]
DATABASE_URL=postgresql://postgres:[email protected]:5432/keyshade_db
[email protected]

GITHUB_CLIENT_ID=
GITHUB_CLIENT_SECRET=
GITHUB_CALLBACK_URL=


SMTP_HOST=
SMTP_PORT=
SMTP_EMAIL_ADDRESS=
Expand Down
5 changes: 1 addition & 4 deletions .github/workflows/api.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,7 @@ jobs:
GITHUB_CLIENT_ID: dummy
GITHUB_CLIENT_SECRET: dummy
GITHUB_CALLBACK_URL: dummy
run: |
docker compose up -d
pnpm run e2e:api
docker compose down
run: pnpm run e2e:api

- name: Upload e2e test coverage reports to Codecov
uses: codecov/codecov-action@v3
Expand Down
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,7 @@ Thumbs.db
.next
.vscode
.env
pnpm-lock.yaml
pnpm-lock.yaml

# Database
data/
5 changes: 1 addition & 4 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

pnpm run lint:fix && pnpm run prettier:fix && pnpm run test:api
docker compose up -d
pnpm run e2e:api
docker compose down
pnpm run lint:fix && pnpm run prettier:fix && pnpm run test:api && pnpm run e2e:api
2 changes: 0 additions & 2 deletions apps/api/src/app/app.module.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { Module } from '@nestjs/common'
import { AppController } from './app.controller'
import { SupabaseModule } from '../supabase/supabase.module'
import { ConfigModule } from '@nestjs/config'
import { PassportModule } from '@nestjs/passport'
import { AuthModule } from '../auth/auth.module'
Expand All @@ -25,7 +24,6 @@ import { EventModule } from '../event/event.module'
isGlobal: true
}),
PassportModule,
SupabaseModule,
AuthModule,
PrismaModule,
CommonModule,
Expand Down
9 changes: 0 additions & 9 deletions apps/api/src/supabase/supabase.module.ts

This file was deleted.

19 changes: 0 additions & 19 deletions apps/api/src/supabase/supabase.service.spec.ts

This file was deleted.

23 changes: 0 additions & 23 deletions apps/api/src/supabase/supabase.service.ts

This file was deleted.

21 changes: 21 additions & 0 deletions docker-compose-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Set the version of docker compose to use
version: '3.9'

# The containers that compose the project
services:
db:
image: postgres:13
restart: always
container_name: integration-tests-prisma
ports:
- '5432:5432'
environment:
POSTGRES_USER: prisma
POSTGRES_PASSWORD: prisma
POSTGRES_DB: tests
networks:
- keyshade-test

networks:
keyshade-test:
driver: bridge
20 changes: 12 additions & 8 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,19 @@
# Set the version of docker compose to use
version: '3.9'

# The containers that compose the project
services:
db:
image: postgres:13
restart: always
container_name: integration-tests-prisma
ports:
- '5433:5432'
- '5432:5432'
environment:
POSTGRES_USER: prisma
POSTGRES_PASSWORD: prisma
POSTGRES_DB: tests
POSTGRES_USER: postgres
POSTGRES_PASSWORD: password
POSTGRES_DB: keyshade_db
volumes:
- ./data:/var/lib/postgresql/data
networks:
- keyshade-dev

networks:
keyshade-dev:
driver: bridge
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,9 @@
"build:workspace": "nx run workspace:build",
"test": "nx run-many -t test --parallel",
"test:api": "nx run api:test",
"e2e:api:prepare": "NODE_ENV='e2e' DATABASE_URL='postgresql://prisma:prisma@localhost:5433/tests' pnpm run db:deploy-migrations",
"e2e:api": "pnpm run e2e:api:prepare && NODE_ENV='e2e' DATABASE_URL='postgresql://prisma:prisma@localhost:5433/tests' nx run api:test:e2e -- --coverage --coverageDirectory=coverage-e2e/api --coverageReporters=json",
"e2e:api:prepare": "docker compose down && docker compose -f docker-compose-test.yml up -d && NODE_ENV='e2e' DATABASE_URL='postgresql://prisma:prisma@localhost:5432/tests' pnpm run db:deploy-migrations",
"e2e:api": "pnpm run e2e:api:prepare && NODE_ENV='e2e' DATABASE_URL='postgresql://prisma:prisma@localhost:5432/tests' nx run api:test:e2e -- --coverage --coverageDirectory=coverage-e2e/api --coverageReporters=json && pnpm run e2e:api:teardown",
"e2e:api:teardown": "docker compose -f docker-compose-test.yml down",
"test:web": "nx run web:test",
"test:workspace": "nx run workspace:test",
"start:web": "nx run web:serve --configuration=production",
Expand Down
Loading
Loading