Module: Timescaledb::Rails::ActiveRecord::CommandRecorder

Defined in:
lib/timescaledb/rails/extensions/active_record/command_recorder.rb

Overview

:nodoc:

Instance Method Summary collapse

Instance Method Details

#add_hypertable_compression(*args, &block) ⇒ Object



12
13
14
# File 'lib/timescaledb/rails/extensions/active_record/command_recorder.rb', line 12

def add_hypertable_compression(*args, &block)
  record(:add_hypertable_compression, args, &block)
end

#create_hypertable(*args, &block) ⇒ Object



8
9
10
# File 'lib/timescaledb/rails/extensions/active_record/command_recorder.rb', line 8

def create_hypertable(*args, &block)
  record(:create_hypertable, args, &block)
end

#invert_add_hypertable_compression(args, &block) ⇒ Object



28
29
30
# File 'lib/timescaledb/rails/extensions/active_record/command_recorder.rb', line 28

def invert_add_hypertable_compression(args, &block)
  [:remove_hypertable_compression, args, block]
end

#invert_create_hypertable(args, &block) ⇒ Object



20
21
22
23
24
25
26
# File 'lib/timescaledb/rails/extensions/active_record/command_recorder.rb', line 20

def invert_create_hypertable(args, &block)
  if block.nil?
    raise ::ActiveRecord::IrreversibleMigration, 'create_hypertable is only reversible if given a block (can be empty).' # rubocop:disable Layout/LineLength
  end

  [:drop_table, args.first, block]
end

#invert_remove_hypertable_compression(args, &block) ⇒ Object



32
33
34
35
36
37
38
# File 'lib/timescaledb/rails/extensions/active_record/command_recorder.rb', line 32

def invert_remove_hypertable_compression(args, &block)
  if args.size < 2
    raise ::ActiveRecord::IrreversibleMigration, 'remove_hypertable_compression is only reversible if given table name and compress period.' # rubocop:disable Layout/LineLength
  end

  [:add_hypertable_compression, args, block]
end

#remove_hypertable_compression(*args, &block) ⇒ Object



16
17
18
# File 'lib/timescaledb/rails/extensions/active_record/command_recorder.rb', line 16

def remove_hypertable_compression(*args, &block)
  record(:remove_hypertable_compression, args, &block)
end