Class: SimpleMySQLPartitioning::Range

Inherits:
BasePartitioning show all
Defined in:
lib/simple_mysql_partitioning/range.rb

Instance Attribute Summary

Attributes inherited from BasePartitioning

#klass, #table_name

Instance Method Summary collapse

Methods inherited from BasePartitioning

#drop, #exists?, #initialize

Constructor Details

This class inherits a constructor from SimpleMySQLPartitioning::BasePartitioning

Instance Method Details

#add(pairs_name_with_value) ⇒ Object



7
8
9
10
11
12
# File 'lib/simple_mysql_partitioning/range.rb', line 7

def add(pairs_name_with_value)
  pairs_name_with_value.map do |pair|
    add_partition_sql = SQL.add_sql(table_name, pair.first, pair.last)
    klass.connection.execute(add_partition_sql)
  end
end

#reorganize(pairs_name_with_value, reorganize_partition_name, reorganize_partition_value = 'MAXVALUE') ⇒ Object



14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/simple_mysql_partitioning/range.rb', line 14

def reorganize(pairs_name_with_value, reorganize_partition_name, reorganize_partition_value = 'MAXVALUE')
  pairs_name_with_value.map do |pair|
    klass.connection.execute(
      SQL.reorganize_sql(
        table_name,
        pair.first, pair.last,
        reorganize_partition_name,
        reorganize_partition_value
      )
    )
  end
end