Class: Tablature::Adapters::Postgres::Connection Private

Inherits:
SimpleDelegator
  • Object
show all
Defined in:
lib/tablature/adapters/postgres/connection.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Decorates an ActiveRecord connection with methods that help determine the connections capabilities.

Every attempt is made to use the versions of these methods defined by Rails where they are available and public before falling back to our own implementations for older Rails versions.

Instance Method Summary collapse

Instance Method Details

#postgresql_versionInteger

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

An integer representing the version of Postgres we’re connected to.

postgresql_version is public in Rails 5, but protected in earlier versions.

Returns:

  • (Integer)


40
41
42
43
44
45
46
# File 'lib/tablature/adapters/postgres/connection.rb', line 40

def postgresql_version
  if undecorated_connection.respond_to?(:postgresql_version)
    super
  else
    undecorated_connection.send(:postgresql_version)
  end
end

#supports_hash_partitions?Boolean

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

True if the connection supports hash partitions.

Returns:

  • (Boolean)


30
31
32
# File 'lib/tablature/adapters/postgres/connection.rb', line 30

def supports_hash_partitions?
  postgresql_version >= 110_000
end

#supports_list_partitions?Boolean

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

True if the connection supports list partitions.

Returns:

  • (Boolean)


23
24
25
# File 'lib/tablature/adapters/postgres/connection.rb', line 23

def supports_list_partitions?
  postgresql_version >= 100_000
end

#supports_range_partitions?Boolean

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

True if the connection supports range partitions.

Returns:

  • (Boolean)


16
17
18
# File 'lib/tablature/adapters/postgres/connection.rb', line 16

def supports_range_partitions?
  postgresql_version >= 100_000
end