Module: PgFailover::SequelAdapter

Defined in:
lib/pg_failover/sequel_adapter.rb

Defined Under Namespace

Modules: ConnectionValidator

Class Method Summary collapse

Class Method Details

.enable(databases = Sequel::DATABASES) ⇒ Object



12
13
14
15
16
17
18
# File 'lib/pg_failover/sequel_adapter.rb', line 12

def enable(databases = Sequel::DATABASES)
  register_extension

  databases.each do |db|
    db.extension :postgres_failover_validator if db.adapter_scheme == :postgres
  end
end

.register_extensionObject



6
7
8
9
10
# File 'lib/pg_failover/sequel_adapter.rb', line 6

def register_extension
  ::Sequel::Database.register_extension(:postgres_failover_validator) do |db|
    db.pool.extend(PgFailover::SequelAdapter::ConnectionValidator)
  end
end