Skip to content

Commit

Permalink
rc4
Browse files Browse the repository at this point in the history
  • Loading branch information
Rany Keddo committed Jan 29, 2012
1 parent a78c7c1 commit 5798b8c
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 3 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
@@ -1,3 +1,8 @@

# 1.0.0.rc4 (January 29, 2012)

* added '-- lhm' to the end of statements for more visibility

# 1.0.0.rc3 (January 19, 2012)

* Speedup migrations for tables with large minimum id
Expand Down
10 changes: 8 additions & 2 deletions lib/lhm/sql_helper.rb
Expand Up @@ -21,21 +21,27 @@ def table?(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
Expand Down
2 changes: 1 addition & 1 deletion lib/lhm/version.rb
Expand Up @@ -2,5 +2,5 @@
# Schmidt

module Lhm
VERSION = "1.0.0.rc3"
VERSION = "1.0.0.rc4"
end

0 comments on commit 5798b8c

Please sign in to comment.