Method: MotionRecord::Schema::IndexDefinition#initialize
- Defined in:
- lib/motion_record/schema/index_definition.rb
#initialize(table_name, columns, options = {}) ⇒ IndexDefinition
Initialize the index definition
table_name - name of the table columns - either the String name of the column to index or an Array
of column names
options - optional Hash of options for the index
:unique - set to true to create a unique index
:name - provide a String to override the default index name
13 14 15 16 17 18 19 |
# File 'lib/motion_record/schema/index_definition.rb', line 13 def initialize(table_name, columns, ={}) @table_name = table_name @columns = columns.is_a?(Array) ? columns : [columns] @name = [:name] || build_name_from_columns @unique = !![:unique] end |