Class: AddUniqueIndicies
- Inherits:
-
ActiveRecord::Migration
- Object
- ActiveRecord::Migration
- AddUniqueIndicies
- Defined in:
- lib/generators/surveyor/templates/db/migrate/add_unique_indicies.rb
Class Method Summary collapse
Class Method Details
.down ⇒ Object
11 12 13 14 15 16 17 |
# File 'lib/generators/surveyor/templates/db/migrate/add_unique_indicies.rb', line 11 def self.down remove_index(:response_sets, :name => 'response_sets_ac_idx') add_index(:response_sets, :access_code, :name => 'response_sets_ac_idx') remove_index(:surveys, :name => 'surveys_ac_idx') add_index(:surveys, :access_code, :name => 'surveys_ac_idx') end |
.up ⇒ Object
3 4 5 6 7 8 9 |
# File 'lib/generators/surveyor/templates/db/migrate/add_unique_indicies.rb', line 3 def self.up remove_index(:response_sets, :name => 'response_sets_ac_idx') add_index(:response_sets, :access_code, :name => 'response_sets_ac_idx', :unique => true) remove_index(:surveys, :name => 'surveys_ac_idx') add_index(:surveys, :access_code, :name => 'surveys_ac_idx', :unique => true) end |