diff options
author | Francisco Javier López <fjlopez@gitlab.com> | 2017-12-21 17:31:15 +0300 |
---|---|---|
committer | Douwe Maan <douwe@gitlab.com> | 2017-12-21 17:31:15 +0300 |
commit | 8c6b5baba1d784b1615d023c63fb4531713ef8db (patch) | |
tree | 5a7ebfc046dc8a006db0520350e3378f00fa2bd2 /db | |
parent | 3ee5fd156e3465a1e1c04b2b321c62b577496ee8 (diff) |
LDAP extern_uids are not normalized when updated via API
Diffstat (limited to 'db')
-rw-r--r-- | db/post_migrate/20171219121201_normalize_extern_uid_from_identities.rb | 29 | ||||
-rw-r--r-- | db/schema.rb | 2 |
2 files changed, 30 insertions, 1 deletions
diff --git a/db/post_migrate/20171219121201_normalize_extern_uid_from_identities.rb b/db/post_migrate/20171219121201_normalize_extern_uid_from_identities.rb new file mode 100644 index 00000000000..286721a0894 --- /dev/null +++ b/db/post_migrate/20171219121201_normalize_extern_uid_from_identities.rb @@ -0,0 +1,29 @@ +# See http://doc.gitlab.com/ce/development/migration_style_guide.html +# for more information on how to write migrations for GitLab. + +class NormalizeExternUidFromIdentities < ActiveRecord::Migration + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + MIGRATION = 'NormalizeLdapExternUidsRange'.freeze + DELAY_INTERVAL = 10.seconds + + disable_ddl_transaction! + + class Identity < ActiveRecord::Base + include EachBatch + + self.table_name = 'identities' + end + + def up + ldap_identities = Identity.where("provider like 'ldap%'") + + if ldap_identities.any? + queue_background_migration_jobs_by_range_at_intervals(Identity, MIGRATION, DELAY_INTERVAL) + end + end + + def down + end +end diff --git a/db/schema.rb b/db/schema.rb index 2048c50f892..2b20628bd53 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 20171213160445) do +ActiveRecord::Schema.define(version: 20171219121201) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" |