Sha256: 72c6573151c1036676b617d216f141b5f94a82c8c6f0d645436a9e3d114a5496
Contents?: true
Size: 844 Bytes
Versions: 21
Compression:
Stored size: 844 Bytes
Contents
module Partitioned # # Partition tables by a time field grouping them by week, with # a week defined as seven days starting on Monday. # class ByMonthlyTimeField < ByTimeField self.abstract_class = true # Normalize a partition key value by month. # # @param [Time] time_value the time value to normalize # @return [Time] the value normalized def self.partition_normalize_key_value(time_value) return time_value.at_beginning_of_month end # The size of the partition table, a month # # @return [Integer] the size of this partition def self.partition_table_size return 1.month end partitioned do |partition| partition.base_name lambda { |model, time_field| return model.partition_normalize_key_value(time_field).strftime('%Y%m') } end end end
Version data entries
21 entries across 21 versions & 1 rubygems