Frage

I installed paperclip 2.7 using gem install. I did rails generate paperclip user photo. and then tried migrate the db. But it gave me an error. SQLite3::SQLException: duplicate column name: photo_file_name: ALTER TABLE "users" ADD "photo_file_name" varchar(255)

I read somewhere that I should do delete the development.rb and then do db:create and them migrate again. But that didn't work either. When I did db:create it said already exists. So...I ended up reverting back to my old commit hoping to start again. But when I do db:reset. it tell me i have two migrations left. These two migrations are from rails generate paperclip user photo. What do I do now? How am I to get this to work?

War es hilfreich?

Lösung

if you don't have any data that is important and needs to be saved you can simply drop the db and migrate it all the way back up:

rake db:drop

rake db:create

rake db:migrate

Andere Tipps

Run a migration removing photo_file_name, thus:

def change
  change_table :users do |t|
    t.remove :photo_file_name
  end
end

And start again.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top