Sha256: 402b21b09ec962def611548cd37066c2ed9cc0019778b5f6ed4201924ff15ff0

Contents?: true

Size: 866 Bytes

Versions: 4

Compression:

Stored size: 866 Bytes

Contents

# HyperTableDefinition is a subclass of TableDefinition that provides 
# support for Hypertable-specific features (e.g, max_versions) to
# Rails migrations.

module ActiveRecord
  module ConnectionAdapters #:nodoc:
    class HyperColumnDefinition < Struct.new(:base, :name, :type, :limit, :max_versions, :options) #:nodoc:
    end

    class HyperTableDefinition < TableDefinition
      def column(name, type, options = {})
        column = self[name] || HyperColumnDefinition.new(@base, name, type)
        if options[:limit]
          column.limit = options[:limit]
        elsif native[type.to_sym].is_a?(Hash)
          column.limit = native[type.to_sym][:limit]
        end
        column.max_versions = options[:max_versions]
        column.options = options
        @columns << column unless @columns.include? column
        self
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
hyper_record-0.9.5 lib/active_record/connection_adapters/hyper_table_definition.rb
hyper_record-0.9.4 lib/active_record/connection_adapters/hyper_table_definition.rb
hyper_record-0.9.3 lib/active_record/connection_adapters/hyper_table_definition.rb
hyper_record-0.2.8 lib/active_record/connection_adapters/hyper_table_definition.rb