lib/lhm/locked_switcher.rb in lhm-1.1.0 vs lib/lhm/locked_switcher.rb in lhm-1.2.0

- old
+ new

@@ -1,6 +1,6 @@ -# Copyright (c) 2011, SoundCloud Ltd., Rany Keddo, Tobias Bielohlawek, Tobias +# Copyright (c) 2011 - 2013, SoundCloud Ltd., Rany Keddo, Tobias Bielohlawek, Tobias # Schmidt require 'lhm/command' require 'lhm/migration' require 'lhm/sql_helper' @@ -51,21 +51,22 @@ "set session autocommit = @lhm_auto_commit" ].flatten end def validate - unless table?(@origin.name) && table?(@destination.name) + unless @connection.table_exists?(@origin.name) && + @connection.table_exists?(@destination.name) error "`#{ @origin.name }` and `#{ @destination.name }` must exist" end end private def revert - sql "unlock tables" + @connection.sql("unlock tables") end def execute - sql statements + @connection.sql(statements) end end end