部署到 Heroku 后的 Prisma 迁移问题

问题描述

我有一个用 NextJS 编写的应用部署到 Vercel,并在 Heroku 上启动了 Postresql

之前我使用 MysqL,然后将配置更改为 Postgresql。我已使用 npx prisma migrate save --schema ./prisma/schema.prisma --experimental

将表部署到 Heroku Postgresql

现在,我在执行 npx prisma migrate up --schema ./prisma/schema.prisma --experimental

时遇到了问题

我得到的错误是:

Changes to be applied:

model TableA {
  id Int @default(autoincrement()) @id
  ...skipped columns...
}

model TableB {
  id Int @default(autoincrement()) @id
  ...skipped columns...
}

Checking the datasource for potential data loss...

Database Changes:

Migration                                                        Database actions  Status

20201129201149-patchfix-changed-xxxxxx-aaaaaa   statements.    
20201215212131-add-ttttttt-schema                                statements.    
20201227083423-add-postgresql-database-remote-heroku              statements.    
20201227090719-add-MysqL-heroku-deployed                          statements.    
20210512203825-initial                                            statements.    

You can get the detailed db changes with yarn prisma migrate up --experimental --verbose
Or read about them here:
      ./migrations/20201129201149-patchfix-changed-xxxxxx-aaaaaa/README.md

      ./migrations/20201215212131-add-ttttttt-schema/README.md

      ./migrations/20201227083423-add-postgresql-database-remote-heroku/README.md

      ./migrations/20201227090719-add-MysqL-heroku-deployed/README.md

      ./migrations/20210512203825-initial/README.md

Error: Error querying the database: Error querying the database: db error: ERROR: column "someMaskedColumnName" cannot be cast automatically to type integer
   0: sql_migration_connector::sql_database_step_applier::apply_step
           with index=0
             at migration-engine/connectors/sql-migration-connector/src/sql_database_step_applier.rs:15
   1: migration_core::api::ApplyMigration
           with migration_id="20201129201149-patchfix-changed-xxxxxx-aaaaaa"
             at migration-engine/core/src/api.rs:82

error Command Failed with exit code 1.

请帮我解决这个问题,我好几天都无法解决这个问题。

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)