diff options
author | Robert Speicher <robert@gitlab.com> | 2016-07-08 16:11:45 +0000 |
---|---|---|
committer | Robert Speicher <rspeicher@gmail.com> | 2016-07-10 15:31:15 -0500 |
commit | f17ae70554e7cb1f190439e55f95a4640875b35a (patch) | |
tree | f4f844fced202695f554ae942158550d14e9d06d | |
parent | f6ab19d6506a10584b09455a6202e54efaacfa17 (diff) | |
download | gitlab-ce-f17ae70554e7cb1f190439e55f95a4640875b35a.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
(cherry picked from commit e82c72d1f16f42072ca113da022fa5ebe4d0cfa6)
-rw-r--r-- | CHANGELOG | 3 | ||||
-rw-r--r-- | db/migrate/20160616102642_remove_duplicated_keys.rb | 4 |
2 files changed, 5 insertions, 2 deletions
diff --git a/CHANGELOG b/CHANGELOG index e6b86390a0d..fb6f0d76dbb 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,5 +1,8 @@ Please view this file on the master branch, on stable branches it's out of date. +v 8.9.6 + - Fix broken migration in MySQL. !5005 + v 8.9.5 - Add more debug info to import/export and memory killer. !5108 - Fixed avatar alignment in new MR view. !5095 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 ) |