diff options
author | Robert Speicher <robert@gitlab.com> | 2016-07-08 16:11:45 +0000 |
---|---|---|
committer | Robert Speicher <robert@gitlab.com> | 2016-07-08 16:11:45 +0000 |
commit | e82c72d1f16f42072ca113da022fa5ebe4d0cfa6 (patch) | |
tree | dd5af11f31f3b46c82a6750c2bb6ebb14c65c13c | |
parent | 09f4a8f8f5f6b2c6f074460f3578a2428687e286 (diff) | |
parent | 094cd21c30513346379fc6e0668f203548b05a92 (diff) | |
download | gitlab-ce-e82c72d1f16f42072ca113da022fa5ebe4d0cfa6.tar.gz |
Merge branch 'fix-broken-mysql-migration' into 'master'
Fix broken migration in MySQL
`keys` is a reserved name in MySQL, so if this migration actually attempted to remove any duplicate keys it would fail.
Closes #19344
See merge request !5005
-rw-r--r-- | db/migrate/20160616102642_remove_duplicated_keys.rb | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/db/migrate/20160616102642_remove_duplicated_keys.rb b/db/migrate/20160616102642_remove_duplicated_keys.rb index 00a45d7fe73..180a75e0998 100644 --- a/db/migrate/20160616102642_remove_duplicated_keys.rb +++ b/db/migrate/20160616102642_remove_duplicated_keys.rb @@ -4,12 +4,12 @@ class RemoveDuplicatedKeys < ActiveRecord::Migration select_all("SELECT fingerprint FROM #{quote_table_name(:keys)} GROUP BY fingerprint HAVING COUNT(*) > 1").each do |row| fingerprint = connection.quote(row['fingerprint']) execute(%Q{ - DELETE FROM keys + DELETE FROM #{quote_table_name(:keys)} WHERE fingerprint = #{fingerprint} AND id != ( SELECT id FROM ( SELECT max(id) AS id - FROM keys + FROM #{quote_table_name(:keys)} WHERE fingerprint = #{fingerprint} ) max_ids ) |