Commit e82c72d1 authored by Robert Speicher's avatar Robert Speicher

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
parents 09f4a8f8 094cd21c
......@@ -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
)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment