Method: MotionRecord::Schema::IndexDefinition#execute

Defined in:
lib/motion_record/schema/index_definition.rb

#executeObject

Add the index to the database



22
23
24
25
26
# File 'lib/motion_record/schema/index_definition.rb', line 22

def execute
  index_statement = "CREATE#{' UNIQUE' if @unique} INDEX #{@name} ON #{@table_name} (#{@columns.join ", "})"

  MotionRecord::Base.connection.execute index_statement
end