1

This is what the status of my migrations look like. Any idea how I can remove the two no files? The traditional rake:db:rollback throws an error, which is expected.

Alt. can someone explain to me how I would return to a previous version of my code from github? I've been committing my changes regularly.

Status   Migration ID    Migration Name
--------------------------------------------------
   up     20150518025436  Create posts
   up     20150519185856  Create friendly id slugs
   up     20150519185931  Add slug to posts
   up     20150520013204  Create projects
   up     20150520015405  Add slug to projects
   up     20150520124445  Devise create users
   up     20150520170244  ********** NO FILE **********
   up     20150520171513  ********** NO FILE **********

SOLUTION: I was looking for something like rake db:reset

  • You could create two files with the same names and paste in the content from the deleted migrations. – NM Pennypacker May 20 '15 at 20:07
  • if I dont remember the names? I think Im going to need to revert back to a previous commit on git. –  May 20 '15 at 20:08
  • I tried git reset --hard NUMBER but this doesnt seem to work. How to I go back to a previous commit? Isnt this the entire point of version control, since I made a major slipup? –  May 20 '15 at 20:14
  • `git checkout [hash of commit]` will take you back. – max May 20 '15 at 20:16
  • http://stackoverflow.com/questions/4114095/revert-to-a-previous-git-commit – max May 20 '15 at 20:16
  • that link above I consulted to no help. I tried to `git checkout [hash of commit]`, but when I run `rake db:migrate:status` those two migration names with no file are still showing up –  May 20 '15 at 20:19
  • SOLUTION: I was looking for something like `rake db:reset` –  May 20 '15 at 20:27
  • 1
    Automatic question upvote for using Axl Rose as your avatar – NM Pennypacker May 20 '15 at 20:41
  • same problem here. I created a model and did `rake db:migrate` then mistakenly destroyed model without running `rake db:rollback`. This removed my model and migration as well but did not rollback my migration. – Vijay Meena Jun 13 '15 at 07:02
  • Another point is, rails should not delete migration files which are already migrated. This is problematic. – Vijay Meena Jun 13 '15 at 07:05

0 Answers0