我尝试了这个命令来应用db。
prisma migrate deploy
但它不起作用。以下错误。
Error: P3009
migrate found failed migrations in the target database, new migrations will not be applied. Read more about how to resolve migration issues in a production database: https://pris.ly/d/migrate-resolve
您查看了错误消息提供的文档吗?
https://pris.ly/d/migrate-resolve
这个错误完全是自我描述的:数据库中的迁移失败。为了消除这个错误,你有几个选择:
- 将迁移标记为已回滚,修复迁移并尝试重新部署[https://www.prisma.io/docs/guides/database/production-troubleshooting#option-1-标记-迁移即回收再部署]
prisma migrate resolve --rolled-back "NAME_OF_MIGRATION_TO_ROLLBACK"
- 将迁移标记为已解决(忽略错误(并继续进行https://www.prisma.io/docs/guides/database/production-troubleshooting#option-2手动完成迁移并应用解决方案
prisma migrate resolve --applied "NAME_OF_MIGRATION_TO_APPLY"
- 完全重置数据库,修复迁移并重新应用