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.rb18
1 files changed, 0 insertions, 18 deletions
diff --git a/db/migrate/20160616102642_remove_duplicated_keys.rb b/db/migrate/20160616102642_remove_duplicated_keys.rb
deleted file mode 100644
index 0b896108292..00000000000
--- a/db/migrate/20160616102642_remove_duplicated_keys.rb
+++ /dev/null
@@ -1,18 +0,0 @@
-class RemoveDuplicatedKeys < ActiveRecord::Migration[4.2]
- def up
- 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 #{quote_table_name(:keys)}
- WHERE fingerprint = #{fingerprint}
- AND id != (
- SELECT id FROM (
- SELECT max(id) AS id
- FROM #{quote_table_name(:keys)}
- WHERE fingerprint = #{fingerprint}
- ) max_ids
- )
- })
- end
- end
-end