Sha256: 3a4298eab3be793f8ae19e65b2723cb1ef2d5717b77fc898aeadf100a0caa6a1

Contents?: true

Size: 580 Bytes

Versions: 139

Compression:

Stored size: 580 Bytes

Contents

# frozen_string_literal: true

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

139 entries across 139 versions & 2 rubygems

Version Path
decidim-core-0.30.0.rc3 db/migrate/20170405094258_change_decidim_identities_provider_uid_index_uniqueness.rb
decidim-core-0.30.0.rc2 db/migrate/20170405094258_change_decidim_identities_provider_uid_index_uniqueness.rb
decidim-core-0.30.0.rc1 db/migrate/20170405094258_change_decidim_identities_provider_uid_index_uniqueness.rb
decidim-core-0.29.2 db/migrate/20170405094258_change_decidim_identities_provider_uid_index_uniqueness.rb
decidim-core-0.28.5 db/migrate/20170405094258_change_decidim_identities_provider_uid_index_uniqueness.rb
decidim-core-0.29.1 db/migrate/20170405094258_change_decidim_identities_provider_uid_index_uniqueness.rb
decidim-core-0.28.4 db/migrate/20170405094258_change_decidim_identities_provider_uid_index_uniqueness.rb
decidim-core-0.27.9 db/migrate/20170405094258_change_decidim_identities_provider_uid_index_uniqueness.rb
decidim-core-0.29.0 db/migrate/20170405094258_change_decidim_identities_provider_uid_index_uniqueness.rb
decidim-core-0.28.3 db/migrate/20170405094258_change_decidim_identities_provider_uid_index_uniqueness.rb
decidim-core-0.27.8 db/migrate/20170405094258_change_decidim_identities_provider_uid_index_uniqueness.rb
decidim-core-0.29.0.rc4 db/migrate/20170405094258_change_decidim_identities_provider_uid_index_uniqueness.rb
decidim-core-0.29.0.rc3 db/migrate/20170405094258_change_decidim_identities_provider_uid_index_uniqueness.rb
decidim-core-0.29.0.rc2 db/migrate/20170405094258_change_decidim_identities_provider_uid_index_uniqueness.rb
decidim-core-0.29.0.rc1 db/migrate/20170405094258_change_decidim_identities_provider_uid_index_uniqueness.rb
decidim-core-0.28.2 db/migrate/20170405094258_change_decidim_identities_provider_uid_index_uniqueness.rb
decidim-core-0.27.7 db/migrate/20170405094258_change_decidim_identities_provider_uid_index_uniqueness.rb
decidim-core-0.28.1 db/migrate/20170405094258_change_decidim_identities_provider_uid_index_uniqueness.rb
decidim-core-0.27.6 db/migrate/20170405094258_change_decidim_identities_provider_uid_index_uniqueness.rb
decidim-core-0.26.10 db/migrate/20170405094258_change_decidim_identities_provider_uid_index_uniqueness.rb