在我的 Rails 应用程序中,我最初创建了一个名为的表,该表items
后来被删除并替换为另一个名为products
. 该items
表具有修改序列号字段的旧迁移(显然是在删除它的迁移之前创建的),但是当我运行时此迁移失败heroku run rake db:migrate
:
= ChangeSerialNumberToString: migrating =====================================
-- change_column(:items, :serial_number, :text)
rake aborted!
An error has occurred, this and all later migrations canceled:
PG::Error: ERROR: relation "items" does not exist
: ALTER TABLE "items" ALTER COLUMN "serial_number"
似乎它正在尝试在删除的表上运行迁移,这显然失败了,因为该表不再存在。
在我的本地服务器上,rake db:migrate
运行良好,但rake db:migrate RAILS_ENV=production
导致以下错误:
== ChangeSerialNumberToString: migrating =====================================
-- change_column(:items, :serial_number, :text)
rake aborted!
An error has occurred, this and all later migrations canceled:
Could not find table 'items'
有任何想法吗?谢谢!