为什么 Prisma Migrate 会检测到漂移并将其解释为外键被删除,然后再次添加相同的外键?

问题描述 投票:0回答:1

我在 Heroku 上托管的 NextJS prisma MySQL 8 堆栈上有一个正在进行的 Web 应用程序项目。它已经在生产中顺利运行了大约 6 个月。 2023 年底,我的 MySQL 5.6 数据库托管计划即将停用,我被迫更改计划并升级到 MySQL 8,从 mysqldump 恢复我的数据库。 现在,当我运行 npx prisma migrate dev 时,出现以下错误:

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.

[*] Changed the `group` table
  [-] Removed foreign key on columns (createdById)
  [+] Added foreign key on columns (createdById)

[*] Changed the `groupmember` table
  [-] Removed foreign key on columns (groupId)
  [-] Removed foreign key on columns (userId)
  [+] Added foreign key on columns (groupId)
  [+] Added foreign key on columns (userId)

这对我来说毫无意义。它将这种漂移描述为“删除了外键,然后添加了具有相同名称的相同外键”。 我无法使用

prisma migrate resolve --applied
,因为我的所有迁移都已应用,而且由于这个漂移问题,我无法创建新的迁移。

javascript mysql database prisma
1个回答
0
投票

你得到答案了吗?我也有同样的问题,请告诉我解决方案。 谢谢你

© www.soinside.com 2019 - 2024. All rights reserved.