Our company database just crashed, and the only backup I have is from
yesterday morning. All of the changes since then were logged in our
production.log file as entries similar to:
Processing TimesheetsController#create (for ########## at 2006-12-04
08:31:10) [POST]
Session ID: a5ac831b6af3bb949393ff6b41a3ca38
Parameters: {“commit”=>“Add”, “actionitem”=>{“description”=>""},
“action”=>“create”, “controller”=>“timesheets”,
“timesheet”=>{“project_id”=>“1223”, “category”=>“Travel”,
“billed_position”=>“Assistant Consultant”, “is_personal”=>“1”,
“is_expense”=>“1”, “rate”=>"", “description”=>“test”,
“project_name”=>“1223”, “item_date”=>“12/04/2006”, “user_id”=>“98”,
“hours”=>“0.0”}}
Is there any way to “Easily” recover all of these back into the
database, or is the only solution either writing something myself or
manually entering the entries?
Dylan M. wrote:
Our company database just crashed, and the only backup I have is from
yesterday morning. All of the changes since then were logged in our
production.log file as entries similar to:
Processing TimesheetsController#create (for ########## at 2006-12-04
08:31:10) [POST]
Session ID: a5ac831b6af3bb949393ff6b41a3ca38
Parameters: {“commit”=>“Add”, “actionitem”=>{“description”=>""},
“action”=>“create”, “controller”=>“timesheets”,
“timesheet”=>{“project_id”=>“1223”, “category”=>“Travel”,
“billed_position”=>“Assistant Consultant”, “is_personal”=>“1”,
“is_expense”=>“1”, “rate”=>"", “description”=>“test”,
“project_name”=>“1223”, “item_date”=>“12/04/2006”, “user_id”=>“98”,
“hours”=>“0.0”}}
Is there any way to “Easily” recover all of these back into the
database, or is the only solution either writing something myself or
manually entering the entries?
not easily, no
Your best bet is to write a regex that will parse that log file and
match the params. You should be able to simply eval the that
parameters hash, strip out a few keys and feed that into a
timesheet.update_attributes(hash)