-
Notifications
You must be signed in to change notification settings - Fork 14
ActiveRecord::PendingMigrationError #15
Comments
By server restart, does it mean the entire box or just the rails server? If just the rails server, all you have to do is hit control-c in the terminal you originally started it in. It might just be that rails can't run the migration while the server is running for whatever reason. |
@flanaganm87 you copied and pasted most of the output, but the lines just after you stopped would have been the most helpful. Also, @jaimerump is correct about restarting the Rails server. You don't need to in this particular instance, though, as Rails will continue once the migration is successful. |
I did not have the server running while using the migrate command, but here is the rest of the error $ bin/rake db:migrate RAILS_ENV=development Index name 'index_comments_on_post_id' on table 'comments' already exists/home/action/.rvm/gems/ruby-2.0.0-p247/gems/activerecord-4.0.2/lib/active_record/connection_adapters/abstract/schema_statements.rb:815:in |
@flanaganm87 the important line in there is:
See if that gets you past the error. |
@cdmwebs , I ran the the three mentioned commands, and I ensured that the development.sqlite3 file was removed, and I am still getting the same error as above. |
Any chance you are adding the index twice in separate migrations? A way to test it would be to remove the one added in: db/migrate/20140123223406_create_comments.rb. Then see if the index is still defined in: db/schema.rb. Just search db/schema.rb for "index_comments_on_post_id" after you repeat the steps @cdmwebs gave you. |
Hey @flanaganm87. I just took a look at your migrations and the problem is that you're trying to add multiple indexes.
Removing either the |
I removed the index: true and it worked, I don't understand how this happened though, I don't recall editing this file, and it clearly worked for assignment#1. Thanks though! |
@flanaganm87 I had this same in class issue after migrating to the new box @rockwood helped me resolve it then. |
I CD to nku-rails directory and wanted to ensure my new box was working correctly, so I entered rails server, the server started up successfully and when I went to preview (assignment 1) I now get the following error.
I did some research and found that I am supposed to run the command that it tells me ( bin/rake db:migrate RAILS_ENV=development ), if that does not work ( which it failed ) with the following console message:
CreateComments: migrating =================================================
-- create_table(:comments)
-> 0.0116s
-- add_index(:comments, :post_id)
rake aborted!
I then read that I need to do a server restart, so I tried to reboot the server but I do not have root access to this box. Can a root please restart it for me if that's the case?
The text was updated successfully, but these errors were encountered: