Module: Monogamy::PostgreSQL

Defined in:
lib/monogamy/postgresql.rb

Class Method Summary collapse

Class Method Details

.with_table_lock(connection, quoted_table_name, &block) ⇒ Object



4
5
6
7
8
9
# File 'lib/monogamy/postgresql.rb', line 4

def self.with_table_lock(connection, quoted_table_name, &block)
  connection.transaction do
    connection.execute("LOCK TABLE #{quoted_table_name} IN ACCESS EXCLUSIVE MODE")
    yield
  end
end