Class: Timescaledb::Rails::Chunk
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- Timescaledb::Rails::Chunk
- Defined in:
- lib/timescaledb/rails/models/chunk.rb
Overview
:nodoc:
Instance Method Summary collapse
Instance Method Details
#chunk_full_name ⇒ Object
15 16 17 |
# File 'lib/timescaledb/rails/models/chunk.rb', line 15 def chunk_full_name "#{chunk_schema}.#{chunk_name}" end |
#compress! ⇒ Object
19 20 21 22 23 |
# File 'lib/timescaledb/rails/models/chunk.rb', line 19 def compress! ::ActiveRecord::Base.connection.execute( "SELECT compress_chunk('#{chunk_full_name}')" ) end |
#decompress! ⇒ Object
25 26 27 28 29 |
# File 'lib/timescaledb/rails/models/chunk.rb', line 25 def decompress! ::ActiveRecord::Base.connection.execute( "SELECT decompress_chunk('#{chunk_full_name}')" ) end |
#reorder!(index = nil) ⇒ Object
33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/timescaledb/rails/models/chunk.rb', line 33 def reorder!(index = nil) if index.blank? && !hypertable.reorder? raise ArgumentError, 'Index name is required if reorder policy is not set' end index ||= hypertable.reorder_policy_index_name = ["'#{chunk_full_name}'"] << "'#{index}'" if index.present? ::ActiveRecord::Base.connection.execute( "SELECT reorder_chunk(#{.join(', ')})" ) end |