Class: ApiIdsMustBeUnique
- Inherits:
-
ActiveRecord::Migration
- Object
- ActiveRecord::Migration
- ApiIdsMustBeUnique
- Defined in:
- lib/generators/surveyor/templates/db/migrate/api_ids_must_be_unique.rb
Constant Summary collapse
- API_ID_TABLES =
%w(surveys questions question_groups answers responses response_sets)
Class Method Summary collapse
Class Method Details
.down ⇒ Object
11 12 13 14 15 |
# File 'lib/generators/surveyor/templates/db/migrate/api_ids_must_be_unique.rb', line 11 def down API_ID_TABLES.each do |table| remove_index table, :name => api_id_index_name(table) end end |
.up ⇒ Object
5 6 7 8 9 |
# File 'lib/generators/surveyor/templates/db/migrate/api_ids_must_be_unique.rb', line 5 def up API_ID_TABLES.each do |table| add_index table, 'api_id', :unique => true, :name => api_id_index_name(table) end end |