Whenever I start a migration in my Rails application, I get a SQLite3 error message:
SQLite3::SQLException: duplicate column name: photo_file_name: ALTER TABLE "users" ADD "photo_file_name" varchar(255)
I already have the "Add photo to user" migration. There he is:
class AddAttachmentPhotoToUsers < ActiveRecord::Migration def self.up change_table :users do |t| t.has_attached_file :photo end end def self.down drop_attached_file :users, :photo end end
And here is the user migration:
class CreateUsers < ActiveRecord::Migration def change create_table :users do |t| t.string :name t.string :title t.string :department t.text :skills t.boolean :available t.timestamps end end end
I'm a little confused by this because it tells me that there is a duplicate column name "photo_file_name", but do I need to add it to the "Users" table? It does not make sense. Don't I need to delete it?
Let me know if you need any other details about my application.
source share