Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Ruby

Mysql error during Active Record Tutorial

I'm trying to run rake db:migrate after we edit the RemoveOldTables migration file, but I keep running into an error.

Here's the stack trace: https://gist.github.com/scolon7251/28ae0a112fad69aa3edd

Can anyone assist me in remedying the error?

1 Answer

Tedd Arcuri
Tedd Arcuri
8,058 Points

Hey Sam, If you recall, ActiveRecord migrations have two states, an up and a down. It looks like you're trying to remove a table that doesn't exist, so ActiveRecord doesn't know how to proceed. Check Out section 3.7: http://guides.rubyonrails.org/migrations.html#using-the-up-down-methods

One thing you can do as a quick fix is just comment out the line that is giving you problems and this will usually resolve the issue. This can be a bit of a patch fix, so certainly be sure to go into your console or database and make sure the table did get removed.

You can use rake db:status to check the "up" and "down" states of each migration. Perhaps you rolled back to another version previously and had already removed some data you're telling the system to remove again?

Certainly that Rails Guides article should be able to help you get out of this jam and I hope my explanation could at least provide some sort of clarity as to where to start.