Using LHM (Large Hadron Migrator) there is syntax documentation to add indexes:
require 'lhm'
class SomeMigration < ActiveRecord::Migration
def self.up
Lhm.change_table :foos do |m|
m.add_unique_index [:bar_id, :baz] # add_index if you don't want uniqueness
end
end
def self.down
Lhm.change_table :foos do |m|
m.remove_index [:bar_id, :baz]
end
end
end
How can a specific name for the index be specified in LHM? For adding and removing
I am concerned I will hit the index name length limit as I am using many columns
m.add_unique_index([:long_column, :super_long_column], 'shortened_index_name')