Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--db/post_migrate/20170828124518_downcase_gpg_key_user_email_on_gpg_signatures.rb23
1 files changed, 23 insertions, 0 deletions
diff --git a/db/post_migrate/20170828124518_downcase_gpg_key_user_email_on_gpg_signatures.rb b/db/post_migrate/20170828124518_downcase_gpg_key_user_email_on_gpg_signatures.rb
new file mode 100644
index 00000000000..a11a9b0669f
--- /dev/null
+++ b/db/post_migrate/20170828124518_downcase_gpg_key_user_email_on_gpg_signatures.rb
@@ -0,0 +1,23 @@
+class DowncaseGpgKeyUserEmailOnGpgSignatures < ActiveRecord::Migration
+ DOWNTIME = false
+
+ include Gitlab::Database::MigrationHelpers
+ disable_ddl_transaction!
+
+ class GpgSignature < ActiveRecord::Base
+ self.table_name = 'gpg_signatures'
+
+ include EachBatch
+ end
+
+ def up
+ GpgSignature.each_batch do |relation|
+ relation.update_all('gpg_key_user_email = LOWER(gpg_key_user_email)')
+ end
+ end
+
+ def down
+ # we can't revert the downcasing, but actually we don't need to really, as
+ # downcasing the emails is not a harmful change.
+ end
+end