Reputation: 5772
In my Rails app, I had originally created a table called items
which has since been dropped and replaced with a different table called products
. The items
table has an old migration (which was obviously created before the migration that dropped it) that modifies the serial number field, but this migration fails when I run 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"
It seems that it's trying to run a migration on the dropped table, which obviously fails because the table doesn't exist anymore.
On my local server, rake db:migrate
runs fine, but rake db:migrate RAILS_ENV=production
results in the following error:
== 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'
Any ideas? Thanks!
Upvotes: 1
Views: 349
Reputation: 6948
Delete ChangeSerialNumberToString
migration from your db/migrate directory, commit the changes to heroku and then run the migration.
Upvotes: 1