Sha256: 0f2b25ffe2de4cdd778944d563d946638d7a90f0df5717da228a194f250a9be7

Contents?: true

Size: 829 Bytes

Versions: 7

Compression:

Stored size: 829 Bytes

Contents

# frozen_string_literal: true

require 'active_record/connection_adapters/abstract_adapter'

module ActiveRecord
  module ConnectionAdapters
    class PartitionOptions
      attr_reader :table, :type, :columns, :partition_definitions

      TYPES = %i[range list].freeze

      def initialize(
        table, type,
        columns,
        partition_definitions: []
      )
        @table = table
        @type = type
        @columns = Array.wrap(columns)
        @partition_definitions = build_definitions(partition_definitions)
      end

      private

      def build_definitions(definitions)
        definitions.map do |definition|
          next if definition.is_a?(PartitionDefinition)

          PartitionDefinition.new(definition.fetch(:name), definition.fetch(:values))
        end.compact
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
ridgepole-1.0.7 lib/ridgepole/ext/abstract_adapter/partition_options.rb
ridgepole-1.0.6 lib/ridgepole/ext/abstract_adapter/partition_options.rb
ridgepole-1.0.5 lib/ridgepole/ext/abstract_adapter/partition_options.rb
ridgepole-1.0.4 lib/ridgepole/ext/abstract_adapter/partition_options.rb
ridgepole-1.0.3 lib/ridgepole/ext/abstract_adapter/partition_options.rb
ridgepole-1.0.2 lib/ridgepole/ext/abstract_adapter/partition_options.rb
ridgepole-1.0.2.beta lib/ridgepole/ext/abstract_adapter/partition_options.rb