diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-11-18 16:16:36 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-11-18 16:16:36 +0300 |
commit | 311b0269b4eb9839fa63f80c8d7a58f32b8138a0 (patch) | |
tree | 07e7870bca8aed6d61fdcc810731c50d2c40af47 /db/post_migrate/20200310215714_migrate_saml_identities_to_scim_identities.rb | |
parent | 27909cef6c4170ed9205afa7426b8d3de47cbb0c (diff) |
Add latest changes from gitlab-org/gitlab@14-5-stable-eev14.5.0-rc42
Diffstat (limited to 'db/post_migrate/20200310215714_migrate_saml_identities_to_scim_identities.rb')
-rw-r--r-- | db/post_migrate/20200310215714_migrate_saml_identities_to_scim_identities.rb | 29 |
1 files changed, 0 insertions, 29 deletions
diff --git a/db/post_migrate/20200310215714_migrate_saml_identities_to_scim_identities.rb b/db/post_migrate/20200310215714_migrate_saml_identities_to_scim_identities.rb deleted file mode 100644 index 570eec53be3..00000000000 --- a/db/post_migrate/20200310215714_migrate_saml_identities_to_scim_identities.rb +++ /dev/null @@ -1,29 +0,0 @@ -# frozen_string_literal: true - -class MigrateSamlIdentitiesToScimIdentities < ActiveRecord::Migration[6.0] - DOWNTIME = false - - class Identity < ActiveRecord::Base - self.table_name = 'identities' - - include ::EachBatch - end - - def up - Identity - .joins('INNER JOIN saml_providers ON saml_providers.id = identities.saml_provider_id') - .where('saml_providers.group_id IN (SELECT group_id FROM scim_oauth_access_tokens)') - .select('identities.extern_uid, identities.user_id, saml_providers.group_id, TRUE AS active, - identities.created_at, CURRENT_TIMESTAMP AS updated_at') - .each_batch do |batch| - data_to_insert = batch.map do |record| - record.attributes.extract!("extern_uid", "user_id", "group_id", "active", "created_at", "updated_at") - end - - Gitlab::Database.main.bulk_insert(:scim_identities, data_to_insert, on_conflict: :do_nothing) # rubocop:disable Gitlab/BulkInsert - end - end - - def down - end -end |