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

  • Home
  • SEARCH
  • 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 44343
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T15:38:14+00:00 2026-05-10T15:38:14+00:00

Experienced with Rails / ActiveRecord 2.1.1 You create a first version with (for example)

  • 0

Experienced with Rails / ActiveRecord 2.1.1

  • You create a first version with (for example) ruby script\generate scaffold product title:string description:text image_url:string
  • This create (for example) a migration file called 20080910122415_create_products.rb
  • You apply the migration with rake db:migrate
  • Now, you add a field to the product table with ruby script\generate migration add_price_to_product price:decimal
  • This create a migration file called 20080910125745_add_price_to_product.rb
  • If you try to run rake db:migrate, it will actually revert the first migration, not apply the next one! So your product table will get destroyed!
  • But if you ran rake alone, it would have told you that one migration was pending

Pls note that applying rake db:migrate (once the table has been destroyed) will apply all migrations in order.

The only workaround I found is to specify the version of the new migration as in:

rake db:migrate version=20080910125745 

So I’m wondering: is this an expected new behavior?

  • 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. 2026-05-10T15:38:15+00:00Added an answer on May 10, 2026 at 3:38 pm

    You should be able to use

    rake db:migrate:up  

    to force it to go forward, but then you risk missing interleaved migrations from other people on your team

    if you run

    rake db:migrate  

    twice, it will reapply all your migrations.

    I encounter the same behavior on windows with SQLite, it might be a bug specific to such an environment.

    Edit — I found why. In the railstie database.rake task you have the following code :

    desc 'Migrate the database through scripts in db/migrate. Target specific version with VERSION=x. Turn off output with VERBOSE=false.' task :migrate => :environment do   ActiveRecord::Migration.verbose = ENV['VERBOSE'] ? ENV['VERBOSE'] == 'true' : true   ActiveRecord::Migrator.migrate('db/migrate/', ENV['VERSION'] ? ENV['VERSION'].to_i : nil)   Rake::Task['db:schema:dump'].invoke if ActiveRecord::Base.schema_format == :ruby end 

    Then in my environment variables I have

    echo %Version% #=> V3.5.0f 

    in Ruby

    ENV['VERSION'] # => V3.5.0f ENV['VERSION'].to_i #=>0 not nil ! 

    thus the rake task calls

    ActiveRecord::Migrator.migrate('db/migrate/', 0) 

    and in ActiveRecord::Migrator we have :

    class Migrator#:nodoc:   class << self     def migrate(migrations_path, target_version = nil)       case         when target_version.nil?              then up(migrations_path, target_version)         when current_version > target_version then down(migrations_path, target_version)         else                                       up(migrations_path, target_version)       end     end 

    Yes, rake db:migrate VERSION=0 is the long version for rake db:migrate:down

    Edit – I would go update the lighthouse bug but I the super company proxy forbids that I connect there

    In the meantime you may try to unset Version before you call migrate …

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

Sidebar

Ask A Question

Stats

  • Questions 60k
  • Answers 61k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • added an answer declare @startID int, @endID int, @rowsEach int select @startID =… May 11, 2026 at 9:35 am
  • added an answer (Edit: expanded on the answer to answer some of the… May 11, 2026 at 9:35 am
  • added an answer If you use the 'save authentication' feature, your password is… May 11, 2026 at 9:35 am

Related Questions

Experienced with Rails / ActiveRecord 2.1.1 You create a first version with (for example)
I am working on a rails application (I have some experience with rails). But,
( Updated a little ) I'm not very experienced with internationalization using PHP, it
Sorry, I'm not terribly experienced with Ant. I like the eclipse Export ant buildfile
I'm running my C++ program in gdb. I'm not real experienced with gdb, but
Our team is experienced in web development (tomcat/Oracle) but not with AJAX on our
I'm a pretty experienced Grails developer, but most of my experience has been with
I am not the most experienced GUI programmer, so bear with me here. I
My experience with MySQL is very basic. The simple stuff is easy enough, but
Does anyone have any experience with how well web services build with Microsoft's WCF

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.