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

Setup database #22

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
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
6 changes: 5 additions & 1 deletion .env.production
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
#SUPABASE
NEXT_PUBLIC_SUPABASE_URL=""
NEXT_PUBLIC_SUPABASE_ANON_KEY=""
NEXT_PUBLIC_SUPABASE_ANON_KEY=""

#PRISMA
DATABASE_URL=""
DIRECT_URL=""
16 changes: 8 additions & 8 deletions .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,20 @@ on:
pull_request:
branches: ['main']

env:
NODE_VERSION: 18.x

jobs:
build:
runs-on: ubuntu-latest

strategy:
matrix:
node-version: [18.x]

steps:
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
- uses: actions/checkout@v4
- name: Use Node.js ${{ env.NODE_VERSION }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
node-version: ${{ env.NODE_VERSION }}
cache: 'npm'
- run: npm i
- run: npm run lint
- run: npm run test:ci
188 changes: 188 additions & 0 deletions package-lock.json

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

9 changes: 8 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,14 @@
"build": "next build",
"start": "next start",
"lint": "next lint",
"test:ci": "jest --ci"
"test:ci": "jest --ci",
"db:local:migrate": "npx dotenv -e .env.local -- prisma migrate dev",
"db:prod:migrate": "npx dotenv -e .env.production -- prisma migrate dev",
"db:local:seed": "npx dotenv -e .env.local -- node prisma/seed.js",
"db:prod:seed": "npx dotenv -e .env.production -- node prisma/seed.js"
},
"dependencies": {
"@prisma/client": "^5.11.0",
"@radix-ui/react-avatar": "^1.0.4",
"@radix-ui/react-dialog": "^1.0.5",
"@radix-ui/react-dropdown-menu": "^2.0.6",
Expand All @@ -32,6 +37,7 @@
"date-fns": "^3.5.0",
"next": "^14.1.3",
"next-themes": "^0.3.0",
"prisma": "^5.11.0",
"react": "^18.2.0",
"react-day-picker": "^8.10.0",
"react-dom": "^18.2.0",
Expand All @@ -49,6 +55,7 @@
"@types/react": "^18.2.66",
"@types/react-dom": "^18.2.21",
"autoprefixer": "^10.4.18",
"dotenv-cli": "^7.4.1",
"eslint": "^8.57.0",
"eslint-config-next": "^14.1.3",
"jest": "^29.7.0",
Expand Down
20 changes: 20 additions & 0 deletions prisma/schema.prisma
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
generator client {
provider = "prisma-client-js"
}

datasource db {
provider = "postgresql"
url = env("DATABASE_URL")
directUrl = env("DIRECT_URL")
}

model Profile {
id String @id @default(uuid()) @db.Uuid
first_name String
last_name String
country String
display_name String
propic String?
user_id String @db.Uuid
created_at DateTime @default(now()) @db.Timestamptz(6)
}
15 changes: 15 additions & 0 deletions prisma/seed.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
const { PrismaClient } = require('@prisma/client');

const prisma = new PrismaClient();

const seedDb = async () => {};

seedDb()
.then(async () => {
await prisma.$disconnect();
})
.catch(async (e) => {
console.error(e);
await prisma.$disconnect();
process.exit(1);
});
Loading