Sha256: 7c5f84b5f8d1c765d54afa715328e18ce08a362e31f23d734fbdc0142747beca
Contents?: true
Size: 529 Bytes
Versions: 11
Compression:
Stored size: 529 Bytes
Contents
class ApiIdsMustBeUnique < ActiveRecord::Migration API_ID_TABLES = %w(surveys questions question_groups answers responses response_sets) class << self def up API_ID_TABLES.each do |table| add_index table, 'api_id', :unique => true, :name => api_id_index_name(table) end end def down API_ID_TABLES.each do |table| remove_index table, :name => api_id_index_name(table) end end private def api_id_index_name(table) "uq_#{table}_api_id" end end end
Version data entries
11 entries across 11 versions & 4 rubygems