lib/lhm/sql_helper.rb in lhm-1.0.0.rc3 vs lib/lhm/sql_helper.rb in lhm-1.0.0.rc4

- old
+ new

@@ -19,23 +19,29 @@ def table?(table_name) connection.table_exists?(table_name) end def sql(statements) - [statements].flatten.each { |statement| connection.execute(statement) } + [statements].flatten.each do |statement| + connection.execute(tagged(statement)) + end rescue ActiveRecord::StatementInvalid, Mysql::Error => e error e.message end def update(statements) [statements].flatten.inject(0) do |memo, statement| - memo += connection.update(statement) + memo += connection.update(tagged(statement)) end rescue ActiveRecord::StatementInvalid, Mysql::Error => e error e.message end private + + def tagged(statement) + statement + " -- lhm" + end def column_definition(cols) Array(cols).map do |column| column.to_s.match(/`?([^\(]+)`?(\([^\)]+\))?/).captures end