How do I "Run a Migration to Update the Database."

So I figured out that part but how do I “Run a migration to update the database.” I went to stack overflow and got the following code: $ rails generate migration. When I run that I get the following error: “Remember to use ‘rake’ to run the migration.” When do I use “rake” how do I use “rake” why do I use “rake” what the h3ll is “rake”? I’m on codecademy because I have never used ruby on rails. Why isn’t any of this explained in the lesson? Thank you in advance for your assistance.

Okay so I just read the error messages and guessed a whole bunch of times. Eventually, I typed in /bin/rake db:migrate RAILS_ENV=test. I don’t see how I could have gotten that on the first try just by reading the instructions. Did I miss something? Is there a rails guide that I need to read before attempting theses exercises. I feel like I am doing things which is really cool, but I don’t feel like I have really learned anything as I don’t see how all these commands fit together and why I should do x, y, z. In all the programming lessons if you read the instructions very carefully, have a good grasp of prior lessons and carefully write your code you can get the correct result on the first attempt. I don’t see how you can do that on this particular exercise…

Hi @mattheal,

Your /bin/rake ... command will work as you saw, but the exercise is actually expecting you to run rake db:migrate instead :slight_smile:

I’m not sure if the lesson skipped over some stuff or not, if you give me a link to the exercise you’re on I can take a look and see if it needs fixing though.

2 Likes

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.