lib/lhm/locked_switcher.rb in lhm-2.1.0 vs lib/lhm/locked_switcher.rb in lhm-2.2.0
- old
+ new
@@ -36,21 +36,21 @@
def switch
[
"lock table `#{ @origin.name }` write, `#{ @destination.name }` write",
"alter table `#{ @origin.name }` rename `#{ @migration.archive_name }`",
"alter table `#{ @destination.name }` rename `#{ @origin.name }`",
- "commit",
- "unlock tables"
+ 'commit',
+ 'unlock tables'
]
end
def uncommitted(&block)
[
- "set @lhm_auto_commit = @@session.autocommit",
- "set session autocommit = 0",
+ 'set @lhm_auto_commit = @@session.autocommit',
+ 'set session autocommit = 0',
yield,
- "set session autocommit = @lhm_auto_commit"
+ 'set session autocommit = @lhm_auto_commit'
].flatten
end
def validate
unless @connection.table_exists?(@origin.name) &&
@@ -60,10 +60,10 @@
end
private
def revert
- @connection.sql("unlock tables")
+ @connection.sql('unlock tables')
end
def execute
@connection.sql(statements)
end