Sha256: 2c02599b06f17abc737c0662c61a4a36c7f89b709d9cc0ca00c21a8e52dc8f57

Contents?: true

Size: 473 Bytes

Versions: 4

Compression:

Stored size: 473 Bytes

Contents

class ChangeDecidimIdentitiesProviderUidIndexUniqueness < ActiveRecord::Migration[5.0]
  def change
    remove_index :decidim_identities, [:provider, :uid]
    add_index :decidim_identities, [:provider, :uid, :decidim_organization_id], unique: true,
    name: "decidim_identities_provider_uid_organization_unique"

    Decidim::Identity.includes(:user).find_each do |identity|
      identity.organization = identity.user.organization
      identity.save!
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
decidim-core-0.2.0 db/migrate/20170405094258_change_decidim_identities_provider_uid_index_uniqueness.rb
decidim-core-0.1.0 db/migrate/20170405094258_change_decidim_identities_provider_uid_index_uniqueness.rb
decidim-core-0.0.8.1 db/migrate/20170405094258_change_decidim_identities_provider_uid_index_uniqueness.rb
decidim-core-0.0.7 db/migrate/20170405094258_change_decidim_identities_provider_uid_index_uniqueness.rb