티스토리 뷰
The main differences between the prisma migrate dev and prisma db push commands are:
1. Purpose and Workflow
- migrate dev is designed for development environments and is used to create, apply, and track migrations. It generates SQL migration files based on changes in your Prisma schema, applies them to your database, and updates the migration history. This command helps you maintain a record of all schema changes, which can be shared and applied in other environments (like production or CI/CD) Prisma Migrate CLI reference, How does Prisma Migrate work?.
- db push is intended for rapid prototyping and development. It directly synchronizes your database schema with your Prisma schema without creating migration files or updating migration history. This is useful for quickly iterating on your schema locally, but it does not provide a record of changes or support deploying those changes to other environments Prototyping your schema.
2. Migration Files and History
- migrate dev creates and applies migration files, which are stored in your project and can be version-controlled.
- db push does not create migration files or update the migrations table; it simply updates the database to match the current Prisma schema.
3. Data Loss and Safety
- migrate dev can prompt you to reset your database if it detects schema drift (differences between the migration history and the actual database schema), which results in data loss in the development database. This is safe in development but should not be used in production Prisma Migrate CLI reference.
- db push will throw an error or require the --accept-data-loss flag if it anticipates changes that could result in data loss Prototyping your schema.
4. Use in Production
- migrate dev is for development only. In production, you should use prisma migrate deploy to apply migrations.
- db push is not recommended for production, except in specific cases like with PlanetScale or MongoDB.
Summary Table:
Feature | migrate dev | db push |
---|---|---|
Migration files | Yes | No |
Migration history | Yes | No |
Data loss risk | Prompts for reset | Requires --accept-data-loss |
Production use | No | No (except special cases) |
Use case | Development, versioning | Rapid prototyping |
For more details, see the official documentation: Prototyping your schema, Prisma Migrate CLI reference.
728x90
반응형
공지사항
최근에 올라온 글
최근에 달린 댓글
- Total
- Today
- Yesterday
TAG
- 인텔리제이(intellij)
- In App Purchase
- 진수 변환
- jstl(java standard tag library)
- React
- System.Diagnostics
- jstl(java standard tag library)-core
- MainActor
- docker
- java-개발 환경 설정하기
- error-java
- 스프링 시큐리티(spring security)-http basic 인증
- 스프링 프레임워크(spring framewordk)
- .submit()
- 메이븐(maven)
- 제품 등록
- nl2br
- java web-mvc
- java 키워드 정리
- 표현 언어(expression language)
- REST API
- 스프링 시큐리티(spring security)
- system.io
- await
- 문자 자르기
- 람다식(lambda expression)
- jsp 오픈 소스
- 스프링 프레임워크(spring framework)
- 특정 문자를 기준으로 자르기
- java.sql
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | 6 | 7 |
8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 | 16 | 17 | 18 | 19 | 20 | 21 |
22 | 23 | 24 | 25 | 26 | 27 | 28 |
29 | 30 |
글 보관함