Sha256: 2037e744efde28acfd0e4aa46af931476f523d2652811da567be62c9b0741cb5
Contents?: true
Size: 817 Bytes
Versions: 9
Compression:
Stored size: 817 Bytes
Contents
require "vanity/adapters/active_record_adapter" class AddParticipantsUniqueIndexMigration < ActiveRecord::Migration<%= migration_version %> # Helper methods to ensure we're connecting to the right database, see # https://github.com/assaf/vanity/issues/295. def connection @connection ||= ActiveRecord::Base.connection end alias_method :default_connection, :connection def with_vanity_connection @connection = Vanity::Adapters::ActiveRecordAdapter::VanityRecord.connection yield @connection = default_connection end def change with_vanity_connection do remove_index :vanity_participants, :name => "by_experiment_id_and_identity" add_index :vanity_participants, [:experiment_id, :identity], :name => "by_experiment_id_and_identity", :unique => true end end end
Version data entries
9 entries across 9 versions & 1 rubygems