summaryrefslogtreecommitdiff
path: root/db
diff options
context:
space:
mode:
authorLin Jen-Shin <godfat@godfat.org>2017-06-29 22:24:28 +0800
committerLin Jen-Shin <godfat@godfat.org>2017-06-29 22:24:28 +0800
commitac089ba5af5387067739248ac7205af8ff0dcfab (patch)
tree957194a8ce6c1a9660bd1923be9e782d26aceef4 /db
parent3f89d9c4303e16014c3fafe4e020d584b30aca67 (diff)
downloadgitlab-ce-ac089ba5af5387067739248ac7205af8ff0dcfab.tar.gz
Only indent if the subsequent line is a subquery
Diffstat (limited to 'db')
-rw-r--r--db/migrate/20170622135451_rename_duplicated_variable_key.rb24
1 files changed, 12 insertions, 12 deletions
diff --git a/db/migrate/20170622135451_rename_duplicated_variable_key.rb b/db/migrate/20170622135451_rename_duplicated_variable_key.rb
index 1005a212131..368718ab0ce 100644
--- a/db/migrate/20170622135451_rename_duplicated_variable_key.rb
+++ b/db/migrate/20170622135451_rename_duplicated_variable_key.rb
@@ -8,18 +8,18 @@ class RenameDuplicatedVariableKey < ActiveRecord::Migration
def up
execute(<<~SQL)
UPDATE ci_variables
- SET #{key} = CONCAT(#{key}, #{underscore}, id)
- WHERE id IN (
- SELECT *
- FROM ( -- MySQL requires an extra layer
- SELECT dup.id
- FROM ci_variables dup
- INNER JOIN (SELECT max(id) AS id, #{key}, project_id
- FROM ci_variables tmp
- GROUP BY #{key}, project_id) var
- USING (#{key}, project_id) where dup.id <> var.id
- ) dummy
- )
+ SET #{key} = CONCAT(#{key}, #{underscore}, id)
+ WHERE id IN (
+ SELECT *
+ FROM ( -- MySQL requires an extra layer
+ SELECT dup.id
+ FROM ci_variables dup
+ INNER JOIN (SELECT max(id) AS id, #{key}, project_id
+ FROM ci_variables tmp
+ GROUP BY #{key}, project_id) var
+ USING (#{key}, project_id) where dup.id <> var.id
+ ) dummy
+ )
SQL
end