jeudi 10 septembre 2015

Rake aborted due to Migration error

I was changing the name of my previous followers model. I decided to go back to it's original name but was having errors. I decided to use the Drop_table method to solve the issue but further issue pursist. I deleted any file related to followers and did rake db:schema:load which resulted in no errors. But whenever I try to do

rails g model Follower follower_id:integer followed_id:integer

and edit it to

def change create_table :followers do |t| t.integer :follower_id t.integer :followed_id

  t.timestamps
end
add_index :followers, :follower_id
add_index :followers, :leader_id
add_index :followers, [:follower_id, :leader_id], unique: true

end

rake db:migrate and I get as follows. Anyone has an idea how I'll be able to fix this issue without having to start from the beginning? any help is appreciated. Thank you.

== 20150910203914 CreateFollowers: migrating ================================== -- create_table(:followers) -> 0.0011s -- add_index(:followers, :follower_id) -> 0.0004s -- add_index(:followers, :leader_id) rake aborted! StandardError: An error has occurred, this and all later migrations canceled:

SQLite3::SQLException: table followers has no column named leader_id: CREATE INDEX "index_followers_on_leader_id" ON "followers" ("leader_id")/Users/Steven/.rvm/gems/ruby-2.1.3/gems/sqlite3-1.3.10/lib/sqlite3/database.rb:91:in `initialize'

Aucun commentaire:

Enregistrer un commentaire