Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8799607
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T00:22:11+00:00 2026-06-14T00:22:11+00:00

I generated a new rails migration: rails generate migration some_new_column_to_table edit: — ran the

  • 0

I generated a new rails migration:

rails generate migration some_new_column_to_table

edit: —

ran the migration:

rake db:migrate

updated test db:

rake db:test:prepare

realized I hadn’t added anything to the change method, then

updated the migration file:

class AddSomeColumnToTable < ActiveRecord::Migration
  def change
    add_column :table, :some_column, :string
    add_index :table, :some_column
  end
end

ran the migration (again):

rake db:migrate

updated test db (again):

rake db:test:prepare

After running these commands “some_column” had not be added to the database. I found a solution to this problem here: rake db:migrate is not working

rake db:drop:all
rake db:create:all
rake db:migrate

Why did this fix the problem?
How can I prevent it in the future?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T00:22:12+00:00Added an answer on June 14, 2026 at 12:22 am

    It’s not clear what your problem is. But your last commands do straighten things out.

    rake db:drop:all  << drop the database
    rake db:create:all  << create the database (not the tables)
    rake db:migrate << build up the database based on the migrations
    

    In my experience, migrations don’t ‘stop working’ and they do exactly as layed out, as they are no more than individual commands. But, they require their execution to be done in order, so if you start editing the migrations, you have to be aware of whether a migration has run or not. Migration problems are typically the result of our editing them out-of-sequence. The safest best is to don’t edit migrations that have run already. First do any of the following:

    rake db:rollback  << rollback the last migration (you can do this multiple times)
    rake db:migrate VERSION=00000   << This will rollback to a specific migration
    rake db:rollback STEP=2 << rollback 2 migrations
    

    Hopefully that’s helpful.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

When I try to run rake test on my newly generated rails application I
Running the command generates new rails projects: $ rails generate controller home index The
If I generate new model, view and controller with rails scaffold generator I get
I'm new to rails trying to modify a model generated by scaffolding in rails
I've added a column to a db in rails via a migration, and updated
I created a new rails 3.2.0.rc1 app and generated a welcome controller with an
I am working on a rails project using svn. I generated a migration file
I typed this into terminal: rails generate migration CreateAddress and instead of creating a
If I create a table with rails generate migration , I can add an
In order to test a new Rails plugin that I wrote, I'd like to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.