2. Prisma

jinyinshu·2022년 4월 20일
0

insta-backend

목록 보기
2/37

1. Prisma

prisma.io
https://www.prisma.io/docs/getting-started/setup-prisma/start-from-scratch/relational-databases-node-postgres

npm install prisma -D ??

npm install prisma --save-dev
npx prisma
npx prisma init

2. DB connect

pgAdmin 에 가서
DB에 insta 만들것.

.env파일에
DATABASE_URL="postgresql://postgres:12345@localhost:5432/insta?schema=public"

user: postgres
password: 12345
db name: insta

Vscode 에서 Extension에서 prism install

check!!!!!!!!!!!!!

3. Prisma migrate

prima/schema.prisma 안에

model User {
id Int @default(autoincrement()) @id
username String
email String
}

npx prisma migrate dev
-->pgAdmin에서 DB연결확인할 것.

4. Prisma Client

https://www.prisma.io/docs/concepts/components/prisma-client

npm install @prisma/client

import { PrismaClient } from '@prisma/client'

const prisma = new PrismaClient()

5. Prisma Studio

npm prisma studio

profile
코딩하는초딩쌤

0개의 댓글