Sha256: b3c78dc3a6019e8a265c7a0a4cdf6842e025d4e3502c50a665d1e17b1288da9f
Contents?: true
Size: 659 Bytes
Versions: 4
Compression:
Stored size: 659 Bytes
Contents
# frozen_string_literal: true class DbHelper def initialize(config) @config = config connect_db end def connect_db(config_or_url=@config.database_url) ActiveRecord::Base.establish_connection(config_or_url) end def do_in_other_db(config_or_url) saved_config = ActiveRecord::Base.connection_db_config connect_db(config_or_url) result = yield connect_db(saved_config) result end def do_without_triggers ActiveRecord::Base.connection.execute('set session_replication_role = replica;') result = yield ActiveRecord::Base.connection.execute('set session_replication_role = default;') result end end
Version data entries
4 entries across 4 versions & 2 rubygems
Version | Path |
---|---|
travis-backup-for-v3-0.1.0 | lib/db_helper.rb |
travis-backup-0.3.0 | lib/db_helper.rb |
travis-backup-0.2.1 | lib/db_helper.rb |
travis-backup-0.2.0 | lib/db_helper.rb |