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_continuous_aggregate_policy(*args, &block) ⇒ Object



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

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

#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_continuous_aggregate(*args, &block) ⇒ Object



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

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

#drop_continuous_aggregate(*args, &block) ⇒ Object



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

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

#invert_add_continuous_aggregate_policy(args, &block) ⇒ Object



108
109
110
# File 'lib/timescaledb/rails/extensions/active_record/command_recorder.rb', line 108

def invert_add_continuous_aggregate_policy(args, &block)
  [:remove_continuous_aggregate_policy, args, block]
end

#invert_add_hypertable_compression(args, &block) ⇒ Object



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

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

#invert_add_hypertable_reorder_policy(args, &block) ⇒ Object



84
85
86
# File 'lib/timescaledb/rails/extensions/active_record/command_recorder.rb', line 84

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

#invert_add_hypertable_retention_policy(args, &block) ⇒ Object



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

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

#invert_create_continuous_aggregate(args, &block) ⇒ Object



96
97
98
# File 'lib/timescaledb/rails/extensions/active_record/command_recorder.rb', line 96

def invert_create_continuous_aggregate(args, &block)
  [:drop_continuous_aggregate, args, block]
end

#invert_create_hypertable(args, &block) ⇒ Object



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

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_drop_continuous_aggregate(args, &block) ⇒ Object



100
101
102
103
104
105
106
# File 'lib/timescaledb/rails/extensions/active_record/command_recorder.rb', line 100

def invert_drop_continuous_aggregate(args, &block)
  if args.size < 2
    raise ::ActiveRecord::IrreversibleMigration, 'drop_continuous_aggregate is only reversible if given view name and view query.' # rubocop:disable Layout/LineLength
  end

  [:create_continuous_aggregate, args, block]
end

#invert_remove_continuous_aggregate_policy(args, &block) ⇒ Object



112
113
114
115
116
117
118
# File 'lib/timescaledb/rails/extensions/active_record/command_recorder.rb', line 112

def invert_remove_continuous_aggregate_policy(args, &block)
  if args.size < 4
    raise ::ActiveRecord::IrreversibleMigration, 'remove_continuous_aggregate_policy is only reversible if given view name, start offset, end offset and schedule interval.' # rubocop:disable Layout/LineLength
  end

  [:add_continuous_aggregate_policy, args, block]
end

#invert_remove_hypertable_compression(args, &block) ⇒ Object



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

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



88
89
90
91
92
93
94
# File 'lib/timescaledb/rails/extensions/active_record/command_recorder.rb', line 88

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



76
77
78
79
80
81
82
# File 'lib/timescaledb/rails/extensions/active_record/command_recorder.rb', line 76

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_continuous_aggregate_policy(*args, &block) ⇒ Object



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

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