class AddIndexToLocks < ActiveRecord::Migration def self.up add_index(:locks, [:resource_name, :key], {:name => "idx_resource_key"}) end def self.down remove_index(:locks, :name => "idx_resource_key") end end