Class: Partitioned::MultiLevel::PartitionManager

Inherits:
PartitionedBase::PartitionManager show all
Defined in:
lib/partitioned/multi_level/partition_manager.rb

Overview

the manger of partitioned requests for models partitioned multiple times

Instance Attribute Summary

Attributes inherited from PartitionedBase::PartitionManager

#parent_table_class

Instance Method Summary collapse

Methods inherited from PartitionedBase::PartitionManager

#archive_old_partition, #archive_old_partition_key_values_set, #archive_old_partitions, #create_new_partition_tables, #create_new_partitions, #delete_infrastructure, #drop_old_partition, #drop_old_partitions, #initialize, #new_partition_key_values_set, #old_partition_key_values_set

Constructor Details

This class inherits a constructor from Partitioned::PartitionedBase::PartitionManager

Instance Method Details

#create_infrastructure(enumerable = [[]]) ⇒ optional

The once called function to prepare a parent table for partitioning as well as create the schema that the child tables will be placed in.



13
14
15
16
17
18
# File 'lib/partitioned/multi_level/partition_manager.rb', line 13

def create_infrastructure(enumerable = [[]])
  super()
  enumerable.each do |*partition_key_values|
    create_partition_schema(*partition_key_values)
  end
end

#create_new_partition(*partition_key_values) ⇒ optional

Create a specific child table that does not currently exist and whose schema (the schema that the table exists in) also already exists (#create_infrastructure is designed to create this).



28
29
30
31
32
33
34
35
36
37
# File 'lib/partitioned/multi_level/partition_manager.rb', line 28

def create_new_partition(*partition_key_values)
  create_partition_table(*partition_key_values)
  if is_leaf_partition?(*partition_key_values)
    add_partition_table_index(*partition_key_values)  
    add_references_to_partition_table(*partition_key_values)
    configurator.run_after_partition_table_create_hooks(*partition_key_values)
  else
    add_parent_table_rules(*partition_key_values)
  end
end