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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T14:09:19+00:00 2026-05-20T14:09:19+00:00

I think I may have deleted a migration file – I have quite a

  • 0

I think I may have deleted a migration file – I have quite a few as I have been changing my tables a lot.

I’m wondering if this will affect my heroku deploy. my heroku rake db:migrate was working fine before but now has stopped working.

heroku is also telling me that a table already exists and aborts the rake task.

Will I need to re-write the missing migration file(s)?

thanks for any help, I really appreciate it.

  • 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-20T14:09:19+00:00Added an answer on May 20, 2026 at 2:09 pm

    No, I don’t think you’ll be able to re-write the migration.. unless of course you know what the datestamp was for the migration filename. If you look at the filenames of your migration files in your db folder you’ll notice that they’re all datestamped.

    This datestamp is actually stored in a field in the database you’re writing to. If you check out your database you’ll notice a ‘schema_migrations’ table and in there you’ll find the datestamps of all of the migrations you’ve already run.

    Migrations are tricky things if you keep deleting migration files. I’d try not to delete older migrations if you can, especially if they’re already pushed to your database.. If you have already pushed them to a database it’s easier if you create a new migration file to fix your database rather than going back into old migrations and refactoring.. it’ll cause you a world of pain trying to do it this way..

    Before you go pulling it apart, make a backup of your heroku database locally before trying to fix your migrations

    heroku db:pull
    

    If you haven’t already pushed your deleted migration files to your heroku branch and you’re only playing with your last migration file, try rolling back your last migration in heroku first, fix your migration, push it back and try again.

    heroku rake db:rollback
    

    If you’ve tried it that way and you’re still running into problems you can do the following. But be warned!! The error you’re seeing is because you’re trying to push a table to your database that already exists. If you put the force => true tag on your new migration you can effectively push it to your database, but you will actually be dropping the existing table and creating a new one so any data in your old table will be lost. But if you’re ok with it and confident you’re not going to break anything you can always use something like this in the top of your migration..

    create_table "table_name", :force => true do |t|
         t.column "name",  :string....  
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I think this may be relatively straight forward. I have a rewrite rule that
Hopefully this question isn't as subjective as I think it may be. I have
I think I may have encountered a bug in mysql, or is it just
I think I may have a misunderstanding of <xsl:variable\> and <xsl:value-of\> so perhaps someone
I think I may have accidently disabled stylecop in my Visual Studio 2008 enviroment.
I think we may have trouble with our existing project. For some reasons we
I think I may have used a repeater when I should have used something
http://pastebin.com/mYk8M038 here is what I have so far... I think it may be something
I think I have a synchronization problem...It may be too basic..Please help.. I have
I think I may have made a mess of my controllers. I have a

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.