6

I deleted my Schema.rb by mistake (sort of) and I can't seem to be able to regenerate it into db/ by using rake db:dump, I don't really know what to do at this point.

Some suggested rake db:dump:all rake db:create:all rake db:migrate

Nothing worked. Please help!

Jason Procka
  • 305
  • 1
  • 6
  • 13

2 Answers2

8

Try running bundle exec rake db:schema:dump.

Refer to Active Record Migrations for more info.

Dharam Gollapudi
  • 6,328
  • 2
  • 34
  • 42
  • This should work. Just as an aside, you may not be required to use `bundle exec` depending on where you have gems installed and how your path is setup. – Justin Wood Feb 28 '16 at 23:37
  • Nothing happened :( When I put that in, it just returned a new line. I don't really know what to do. This happened to me before, and I just used the 3 lines that I put up above with drop:all, create:all, and migrate. But it's no longer working. – Jason Procka Feb 28 '16 at 23:40
  • Try running `bundle exec rake db:schema:dump --trace`. Notice the extra `--trace` option and see what all tasks are being run. – Dharam Gollapudi Feb 28 '16 at 23:42
3

You could try

rake db:drop db:create db:migrate

That should do it. If you're not getting any errors and the schema file is not being regenerated, then something is potentially wacky with your local environment.

Josh Deeden
  • 1,660
  • 1
  • 12
  • 14