Class: ActiveRecord::ConnectionAdapters::IndexDefinition
Do not use. This class is for internal use only.
Relationships & Source Files | |
Inherits: | Object |
Defined in: | activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb |
Overview
Abstract representation of an index definition on a table. Instances of this type are typically created and returned by methods in database adapters. e.g. MySQL::SchemaStatements#indexes
Class Method Summary
Instance Attribute Summary
- #columns readonly
- #comment readonly
- #include readonly
- #lengths readonly
- #name readonly
- #nulls_not_distinct readonly
- #opclasses readonly
- #orders readonly
- #table readonly
- #type readonly
- #unique readonly
- #using readonly
- #valid readonly
- #valid? ⇒ Boolean readonly
- #where readonly
Instance Method Summary
Constructor Details
.new(table, name, unique = false, columns = [], lengths: {}, orders: {}, opclasses: {}, where: nil, type: nil, using: nil, include: nil, nulls_not_distinct: nil, comment: nil, valid: true) ⇒ IndexDefinition
# File 'activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb', line 11
def initialize( table, name, unique = false, columns = [], lengths: {}, orders: {}, opclasses: {}, where: nil, type: nil, using: nil, include: nil, nulls_not_distinct: nil, comment: nil, valid: true ) @table = table @name = name @unique = unique @columns = columns @lengths = (lengths) @orders = (orders) @opclasses = (opclasses) @where = where @type = type @using = using @include = include @nulls_not_distinct = nulls_not_distinct @comment = comment @valid = valid end
Instance Attribute Details
#columns (readonly)
[ GitHub ]#comment (readonly)
[ GitHub ]#include (readonly)
[ GitHub ]#lengths (readonly)
[ GitHub ]#name (readonly)
[ GitHub ]#nulls_not_distinct (readonly)
[ GitHub ]#opclasses (readonly)
[ GitHub ]#orders (readonly)
[ GitHub ]#table (readonly)
[ GitHub ]#type (readonly)
[ GitHub ]#unique (readonly)
[ GitHub ]#using (readonly)
[ GitHub ]#valid (readonly)
[ GitHub ]
#valid? ⇒ Boolean
(readonly)
[ GitHub ]
# File 'activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb', line 42
def valid? @valid end
#where (readonly)
[ GitHub ]Instance Method Details
#column_options
[ GitHub ]#concise_options(options) (private)
[ GitHub ]# File 'activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb', line 65
def ( ) if columns.size == .size && .values.uniq.size == 1 .values.first else end end
#defined_for?(columns = nil, name: nil, unique: nil, valid: nil, include: nil, nulls_not_distinct: nil, **options) ⇒ Boolean
# File 'activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb', line 54
def defined_for?(columns = nil, name: nil, unique: nil, valid: nil, include: nil, nulls_not_distinct: nil, ** ) columns = [:column] if columns.blank? (columns.nil? || Array(self.columns) == Array(columns).map(&:to_s)) && (name.nil? || self.name == name.to_s) && (unique.nil? || self.unique == unique) && (valid.nil? || self.valid == valid) && (include.nil? || Array(self.include) == Array(include).map(&:to_s)) && (nulls_not_distinct.nil? || self.nulls_not_distinct == nulls_not_distinct) end