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:
commit
e82c72d1f1
|
@ -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
|
||||
)
|
||||
|
|
Loading…
Reference in New Issue