Class: ActiveRecord::ConnectionAdapters::IndexDefinition

Inherits:
Object
  • Object
show all
Defined in:
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. ActiveRecord::ConnectionAdapters::MySQL::SchemaStatements#indexes

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(table, name, unique = false, columns = [], lengths: {}, orders: {}, opclasses: {}, where: nil, type: nil, using: nil, comment: nil) ⇒ IndexDefinition

Returns a new instance of IndexDefinition.



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File '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,
  comment: nil
)
  @table = table
  @name = name
  @unique = unique
  @columns = columns
  @lengths = concise_options(lengths)
  @orders = concise_options(orders)
  @opclasses = concise_options(opclasses)
  @where = where
  @type = type
  @using = using
  @comment = comment
end

Instance Attribute Details

#columnsObject (readonly)

:nodoc:



9
10
11
# File 'lib/active_record/connection_adapters/abstract/schema_definitions.rb', line 9

def columns
  @columns
end

#commentObject (readonly)

:nodoc:



9
10
11
# File 'lib/active_record/connection_adapters/abstract/schema_definitions.rb', line 9

def comment
  @comment
end

#lengthsObject (readonly)

:nodoc:



9
10
11
# File 'lib/active_record/connection_adapters/abstract/schema_definitions.rb', line 9

def lengths
  @lengths
end

#nameObject (readonly)

:nodoc:



9
10
11
# File 'lib/active_record/connection_adapters/abstract/schema_definitions.rb', line 9

def name
  @name
end

#opclassesObject (readonly)

:nodoc:



9
10
11
# File 'lib/active_record/connection_adapters/abstract/schema_definitions.rb', line 9

def opclasses
  @opclasses
end

#ordersObject (readonly)

:nodoc:



9
10
11
# File 'lib/active_record/connection_adapters/abstract/schema_definitions.rb', line 9

def orders
  @orders
end

#tableObject (readonly)

:nodoc:



9
10
11
# File 'lib/active_record/connection_adapters/abstract/schema_definitions.rb', line 9

def table
  @table
end

#typeObject (readonly)

:nodoc:



9
10
11
# File 'lib/active_record/connection_adapters/abstract/schema_definitions.rb', line 9

def type
  @type
end

#uniqueObject (readonly)

:nodoc:



9
10
11
# File 'lib/active_record/connection_adapters/abstract/schema_definitions.rb', line 9

def unique
  @unique
end

#usingObject (readonly)

:nodoc:



9
10
11
# File 'lib/active_record/connection_adapters/abstract/schema_definitions.rb', line 9

def using
  @using
end

#whereObject (readonly)

:nodoc:



9
10
11
# File 'lib/active_record/connection_adapters/abstract/schema_definitions.rb', line 9

def where
  @where
end