Andrew Vliet
2010-Jun-29 13:04 UTC
Possible to recover data from log/development.log files?
Hey all. Seems I''ve found a bug in Rails db:migrate - maybe it is, maybe it isn''t. If possible - I''d appreciate some help recovering from it. Apps, OS, etc.: MySQL: Ver 14.12 Distrib 5.0.77, for redhat-linux-gnu (x86_64) using readline 5.1 Rails: 2.3.8, OS: CentOS 5.4 updated as of this past weekend Long story made short. I have a rails app in development mode with a significant amount of data. I created a couple migrations to add a couple columns and remove a couple more. After my first attempt to run the migrations, I realized I''d made a mistake and attempted to revert my changes with a ''rake db:migrate VERSION="<name of migration>"''. Mistake #1: Oops. I typed the name of my migration incorrectly, and it reverted to... wait for it... VERSION="0". That''s the "bug" part - (I don''t think) it shouldn''t be reverting to VERSION="0" whenever it has an error or fails to find a migration... No, I didn''t have an environment variable VERSION="0". Mistake #2: My bad - I didn''t back up the database before applying my changes. 05:30 AM + "meh - simple column change, what could happen..." =~ poop.onstick() log/development.log seems like it contains all the INSERT INTO actions. (crosses fingers) Has anyone ever used the log file to recreate the database..? Am I missing something: is there a better way? Any help, input, or ideas beyond "you should have backed up your DB" would really be appreciated. Thanks, Andrew Vliet 1 403 667 3201 (c) 1 403 648 0627 (w) -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Ar Chron
2010-Jun-29 14:31 UTC
Re: Possible to recover data from log/development.log files?
If you haven''t cleared out your log along the way, you should be able to parse through that and reconstruct your inserts. I know I periodically ''archive off'' my development.log (development.log.thru.20100617 anyone?) just so I have a record (especially when trying to diagnose issues). -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Marnen Laibow-Koser
2010-Jun-30 14:53 UTC
Re: Possible to recover data from log/development.log files?
Ar Chron wrote:> If you haven''t cleared out your log along the way, you should be able to > parse through that and reconstruct your inserts. > > I know I periodically ''archive off'' my development.log > (development.log.thru.20100617 anyone?) just so I have a record > (especially when trying to diagnose issues).Hmm. Perhaps instead of doing that, you should just put your development.log in version control? (I confess that I''ve never needed an archive such as you describe.) Best, -- Marnen Laibow-Koser http://www.marnen.org marnen-sbuyVjPbboAdnm+yROfE0A@public.gmane.org -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On Jun 29, 9:04 am, Andrew Vliet <avl...-AnXiXsLJdwznCSRlgfjLuw@public.gmane.org> wrote:>> Mistake #1: Oops. I typed the name of my migration incorrectly, and it > reverted to... wait for it... VERSION="0".A little late, but another reason ''the rails way'' encourages separate dev and production databases. You will get better performance running under production mode too -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.