summaryrefslogtreecommitdiff
path: root/db/post_migrate/20171219121201_normalize_extern_uid_from_identities.rb
diff options
context:
space:
mode:
authorFilipa Lacerda <filipa@gitlab.com>2017-12-22 06:47:54 +0000
committerFilipa Lacerda <filipa@gitlab.com>2017-12-22 06:47:54 +0000
commit4423b299b73e2b96b980b848fab5cf374361572b (patch)
tree8f2c7b12b3c267efda53918f67210225fac017ff /db/post_migrate/20171219121201_normalize_extern_uid_from_identities.rb
parent0b5947849a32991904f8cbc5e4612d2438b97e0b (diff)
parent36f4710301926bb853b35d9b14a60e03b42def34 (diff)
downloadgitlab-ce-4423b299b73e2b96b980b848fab5cf374361572b.tar.gz
Merge branch 'master' into 22643-manual-job-page
* master: (68 commits) Last push event widget width for fixed layout Added 'admin' persona Docs: move article Artifactory + GL to subject-related folder Mention GitLab Pages when changing username Consolidate the docs when changing a repo path Add docs for automatic redirects when renaming namespaces move "Transfer an existing project into a group" to project docs Do not show Vue pagination if only one page Resolve "Decouple multi-file editor from file list" Update Ruby version to 2.3.6 Skip projects filter on merge requests search Fall back to the `MergeRequestWidgetEntity` LDAP extern_uids are not normalized when updated via API organise content by subject Restore missing language code in datetime_utility.js Add support for defining explicit dependencies to QA factories Document mounting volumes with Docker-in-Docker add missing word to pawel-reduce_cardinality_of_prometheus_metrics.yml Use seconds where possible, and convert to milliseconds for Influxdb consumption update dispatcher to allow for dynamic imports until webpack plugin is updated ...
Diffstat (limited to 'db/post_migrate/20171219121201_normalize_extern_uid_from_identities.rb')
-rw-r--r--db/post_migrate/20171219121201_normalize_extern_uid_from_identities.rb29
1 files changed, 29 insertions, 0 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