티스토리 뷰

PS C:\Users\jangj\Documents\workspace-cursor\schedule-note2> npx prisma migrate dev --name note culurm change

 

Environment variables loaded from .env
Prisma schema loaded from prisma\schema.prisma
Datasource "db": PostgreSQL database "postgres", schema "public" at "aws-0-ap-northeast-2.pooler.supabase.com:5432"

Drift detected: Your database schema is not in sync with your migration history.

The following is a summary of the differences between the expected database schema given your migrations files, and the actual schema of the database.

It should be understood as the set of changes to get from the expected schema to the actual schema.

If you are running this the first time on an existing database, please make sure to read this documentation page:
https://www.prisma.io/docs/guides/database/developing-with-prisma-migrate/troubleshooting-development

 

Troubleshooting | Prisma Documentation

Troubleshooting issues with Prisma Migrate in a development environment.

www.prisma.io

 

 

문제의 원인:
prisma db push 명령은 마이그레이션 파일을 생성하지 않고 데이터베이스 스키마만 직접 변경합니다.
이후 prisma migrate dev 명령을 실행하면 마이그레이션 히스토리와 실제 데이터베이스 스키마 간의 불일치가 발생합니다.

 

해결 방법:

prisma migrate reset --force 
// 명령으로 데이터베이스를 초기화했습니다.
// * reset시 모든 데이터가 삭제됩니다.!!!

prisma migrate dev --name init 
// 명령으로 새로운 마이그레이션 파일을 생성하고 적용했습니다.
728x90
반응형