Sha256: d7d2f07eaba242b60d60f66742ad17970f1b1c2dffa645d1d0eea07568891ec7
Contents?: true
Size: 826 Bytes
Versions: 5
Compression:
Stored size: 826 Bytes
Contents
module Timescaledb class Chunk < ::Timescaledb::ApplicationRecord self.table_name = "timescaledb_information.chunks" self.primary_key = "chunk_name" belongs_to :hypertable, foreign_key: :hypertable_name scope :compressed, -> { where(is_compressed: true) } scope :uncompressed, -> { where(is_compressed: false) } scope :resume, -> do { total: count, compressed: compressed.count, uncompressed: uncompressed.count } end def compress! execute("SELECT compress_chunk(#{chunk_relation})") end def decompress! execute("SELECT decompress_chunk(#{chunk_relation})") end def chunk_relation "('#{chunk_schema}.#{chunk_name}')::regclass" end def execute(sql) self.class.connection.execute(sql) end end end
Version data entries
5 entries across 5 versions & 1 rubygems