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

#add_hypertable_reorder_policy(*args, &block) ⇒ Object



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

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

#add_hypertable_retention_policy(*args, &block) ⇒ Object



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

def add_hypertable_retention_policy(*args, &block)
  record(:add_hypertable_retention_policy, 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



44
45
46
# File 'lib/timescaledb/rails/extensions/active_record/command_recorder.rb', line 44

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

#invert_add_hypertable_reorder_policy(args, &block) ⇒ Object



68
69
70
# File 'lib/timescaledb/rails/extensions/active_record/command_recorder.rb', line 68

def invert_add_hypertable_reorder_policy(args, &block)
  [:remove_hypertable_reorder_policy, args, block]
end

#invert_add_hypertable_retention_policy(args, &block) ⇒ Object



56
57
58
# File 'lib/timescaledb/rails/extensions/active_record/command_recorder.rb', line 56

def invert_add_hypertable_retention_policy(args, &block)
  [:remove_hypertable_retention_policy, args, block]
end

#invert_create_hypertable(args, &block) ⇒ Object



36
37
38
39
40
41
42
# File 'lib/timescaledb/rails/extensions/active_record/command_recorder.rb', line 36

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



48
49
50
51
52
53
54
# File 'lib/timescaledb/rails/extensions/active_record/command_recorder.rb', line 48

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

#invert_remove_hypertable_reorder_policy(args, &block) ⇒ Object



72
73
74
75
76
77
78
# File 'lib/timescaledb/rails/extensions/active_record/command_recorder.rb', line 72

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

  [:add_hypertable_reorder_policy, args, block]
end

#invert_remove_hypertable_retention_policy(args, &block) ⇒ Object



60
61
62
63
64
65
66
# File 'lib/timescaledb/rails/extensions/active_record/command_recorder.rb', line 60

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

  [:add_hypertable_retention_policy, 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

#remove_hypertable_reorder_policy(*args, &block) ⇒ Object



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

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

#remove_hypertable_retention_policy(*args, &block) ⇒ Object



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

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