[Enhancement] Log the SQL command being run when an error occurs
ferventcoder opened this issue · comments
From: https://groups.google.com/forum/#!msg/chucknorrisframework/oXUSEJvrvz4/Fl4W1rAoJDkJ
I understand that if a sql command fails that the command that caused the failure is logged in: RoundhousE.ScriptsRunErrors, however; it would also be nice to have the sql_statement that caused the failure to be written out to the log file so that it is immediately obvious what caused the failure when the user sends the log files from the installation.
I would propose this simple change in DefaultDatabaseMigrator.run_sql:
try
{
database.run_sql(sql_statement, connection_type);
}
catch (Exception ex)
{
Log.bound_to(this).log_an_error_event_containing("Error executing command {0} - {1}", script_name, sql_statement); // please add this line
database.rollback();
Does this sound reasonable?
Fixed in 3902f16