summaryrefslogtreecommitdiff
path: root/db
diff options
context:
space:
mode:
authorAlexis Reigel <mail@koffeinfrei.org>2017-08-28 14:58:10 +0200
committerAlexis Reigel <mail@koffeinfrei.org>2017-09-05 12:18:32 +0200
commite37c46b6a604a055c1a9269083117dc2001e5664 (patch)
tree82d294edc95ba42a4f7f32d727fc43601ba1b01b /db
parentd71d10c983c48b30844090120141058de77095b0 (diff)
downloadgitlab-ce-e37c46b6a604a055c1a9269083117dc2001e5664.tar.gz
downcase all GpgSignature#gpg_key_user_email
Diffstat (limited to 'db')
-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