Module: MysqlPartition::Type::Range

Defined in:
lib/mysql_partition/type/range.rb

Instance Method Summary collapse

Instance Method Details

#add_catch_all_partitionObject



12
13
14
15
16
17
18
19
# File 'lib/mysql_partition/type/range.rb', line 12

def add_catch_all_partition
  unless catch_all_partition_name
    raise "catch_all_partition_name isn't specified"
  end

  sprintf 'ALTER TABLE %s ADD PARTITION (%s)',
    table, build_partition_part(catch_all_partition_name, 'MAXVALUE')
end

#create_partitions(hash) ⇒ Object



5
6
7
8
9
10
# File 'lib/mysql_partition/type/range.rb', line 5

def create_partitions(hash)
  if catch_all_partition_name
    hash.merge!(catch_all_partition_name => "MAXVALUE")
  end
  super(hash)
end

#reorganize_catch_all_partition(hash) ⇒ Object



21
22
23
24
25
26
27
28
# File 'lib/mysql_partition/type/range.rb', line 21

def reorganize_catch_all_partition(hash)
  unless catch_all_partition_name
    raise "catch_all_partition_name isn't specified"
  end

  sprintf 'ALTER TABLE %s REORGANIZE PARTITION %s INTO (%s, PARTITION %s VALUES LESS THAN (MAXVALUE))',
    table, catch_all_partition_name, build_partition_parts(hash), catch_all_partition_name
end