mirror of
https://github.com/wahyd4/gitlabhq.git
synced 2026-08-09 04:36:11 +10:00
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
This commit is contained in:
@@ -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
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user