summaryrefslogtreecommitdiff
path: root/db/migrate/20160616102642_remove_duplicated_keys.rb
diff options
context:
space:
mode:
Diffstat (limited to 'db/migrate/20160616102642_remove_duplicated_keys.rb')
-rw-r--r--db/migrate/20160616102642_remove_duplicated_keys.rb4
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
)