Cezinha Cezer
Cezinha Cezer

Reputation: 38

Error command : heroku run rake db:migrate

I have a simply app with rails 3.2.8 and MySQL in development, when I try to use this command > heroku run rake db:migrate I have this error : PG::Error: ERROR: column "name" of relation "users" already exists : ALTER TABLE "users" ADD COLUMN "name" character varying(255)

here is my schema.rb

http://pastie.org/5132185

I don't know how to do, to fix this error.

Upvotes: 0

Views: 396

Answers (2)

Jason Noble
Jason Noble

Reputation: 3766

You setup the production database correctly in the Gemfile:

group :production do
  gem 'pg'
end

But you also have the gem included in all environments due to line 14:

gem 'pg'

You should specify that mysql is a dev/test only gem:

group :development, :test do
  gem 'mysql'
end

As for your error, it sounds like the column name already exists on the users table. Did another migration add that column?

Upvotes: 1

Avdept
Avdept

Reputation: 2289

Heroku using only PostgreSql, so you have to change in your gemfile from mysql to PG, or use mysql only for test/local and PG for production

gem 'PG' :group => :production

Upvotes: 1

Related Questions