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 6334585
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T18:41:17+00:00 2026-05-24T18:41:17+00:00

I made a mistake in editing a rails migration (I’m using rails 3.1.0rc5). So

  • 0

I made a mistake in editing a rails migration (I’m using rails 3.1.0rc5). So I corrected it and attempted to do a rake db:rollback followed by a rake db:migrate db:test:prepare. But the rollback failed for some reason. Here’s the rollback portion of the migration:

  def down
    drop_table :assets
  end

this is the response from db:rollback:

==  CreateAssets: reverting ===================================================
rake aborted!
An error has occurred, this and all later migrations canceled:

ActiveRecord::IrreversibleMigration

Tasks: TOP => db:rollback
(See full trace by running task with --trace)

so I just manually deleted the assets table in the database (I’m just using the sqlite3 dbs), commented out the drop_table :assets line and ran db:rollback again:

==  CreateAssets: reverting ===================================================
-- drop_table("assets")
rake aborted!
An error has occurred, this and all later migrations canceled:

SQLite3::SQLException: no such table: assets: DROP TABLE "assets"

Tasks: TOP => db:rollback
(See full trace by running task with --trace)

Why is it trying to drop the assets table? I commented out (and actually later deleted) that drop_table :assets line from the migration. I even did a grep -r assets to see where rails might be getting that drop command from, but couldn’t find anything.

So my question is how do I get this migration re-run? And I’m curious where rails is getting that drop command?

UPDATE: It turns out that rails 3.1 actually doesn’t look at the migration class’ down method when rolling back! It looks at the change method’s migration commands and reverses them. That’s why rake db:rollback was trying to drop the assets table even after I removed the drop_table :assets instruction! How I fixed this is I changed the change method to the old rails 3.0 style up method. Then rails looked at the down method which I had removed the drop_table command from and the rollback was successful.

  • 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-05-24T18:41:18+00:00Added an answer on May 24, 2026 at 6:41 pm

    Migrations changed a fair bit with the latest rails, especially reversing migrations.
    I think http://shardul.wordpress.com/2012/01/25/reversible-migrations/ will provide you with the info and options you need.

    btw I had a lot of issues with the 3.1. rc candidates (e.g. rc4, rc5) and have had to stay at 3.0.9 for stable new apps right now.

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

Sidebar

Related Questions

I am making an app where there is a test. I made a mistake
I made a mistake when using Leaks instrument that I thought total living objects
I made the mistake of modifying my original source after importing it into subversion.
EDIT: I had made a mistake during the debugging session that lead me to
-edit- nevermind, i made a mistake in my select statement. Update was working correctly.
I've made the same mistake many times: I've tried to use a Stream that
I do not mean the compile errors because I made a syntax mistake or
IMPORTANT EDIT: Sorry everyone, i made a big mistake in the structure. char *name;
I am an intermediate C programmer. If you have made any coding mistake that
I made a mistake while writing my Django application in hard coding all the

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.