Search code examples
ruby-on-railsrubyherokudbmigrate

Error with heroku run rake db:migrate


I am trying to run the command on Heroku

Heroku run rake db:migrate

but I get the error:

Migrating to AddNameToUsers (20130320002032)
== AddNameToUsers: migrating =================================================
-- add_column(:users, :name, :string)
rake aborted!
An error has occurred, this and all later migrations canceled:

PG::Error: ERROR: relation "users" does not exist
: ALTER TABLE "users" ADD COLUMN "name" character varying(255)

This might have to do with the fact that I had some issues with the migration files on my local server. I managed to work around it and had to delete one of the files, but I worry that I might have deleted something I need that hadn't been migrated to heroku's database?

my github for the account is https://github.com/jeremybelcher/omrails

Any help is appreciated


Solution

  • Your previous migrations are missing.

    You can do:

    rake db:create
    rake db:schema:load
    rake db:migrate
    

    Which will recreate your database based on your schema.rb file.