Module: Timescaledb::Extension

Defined in:
lib/timescaledb/extension.rb

Overview

Provides metadata around the extension in the database

Class Method Summary collapse

Class Method Details

.installed?Boolean

Returns:

  • (Boolean)


15
16
17
# File 'lib/timescaledb/extension.rb', line 15

def installed?
  version.present?
end

.update!Object



19
20
21
# File 'lib/timescaledb/extension.rb', line 19

def update!
  Timescaledb.connection.execute('ALTER EXTENSION timescaledb UPDATE')
end

.versionObject

Returns String version of the timescaledb extension.

Returns:

  • String version of the timescaledb extension



7
8
9
10
11
12
13
# File 'lib/timescaledb/extension.rb', line 7

def version
  @version ||= Timescaledb.connection.query_first(<<~SQL)&.version
    SELECT extversion as version
    FROM pg_extension
    WHERE extname = 'timescaledb'
  SQL
end