Method: PgDice::PgSliceManager#add_partitions

Defined in:
lib/pgdice/pg_slice_manager.rb

#add_partitions(params = {}) ⇒ Object



46
47
48
49
50
51
52
53
54
55
56
57
58
# File 'lib/pgdice/pg_slice_manager.rb', line 46

def add_partitions(params = {})
  table_name = params.fetch(:table_name)
  future_tables = params.fetch(:future, nil)
  future_tables = "--future #{Integer(future_tables)}" if future_tables

  past_tables = params.fetch(:past, nil)
  past_tables = "--past #{Integer(past_tables)}" if past_tables

  intermediate = params.fetch(:intermediate, nil)
  intermediate = '--intermediate' if intermediate.to_s.casecmp('true').zero?

  run_pgslice("add_partitions #{table_name} #{intermediate} #{future_tables} #{past_tables}", params[:dry_run])
end