rosa-build/db/migrate/20120313130930_delete_dubli...

14 lines
356 B
Ruby
Raw Normal View History

# -*- encoding : utf-8 -*-
2012-03-13 13:56:58 +00:00
class DeleteDublicateSubscribes < ActiveRecord::Migration
def up
execute <<-SQL
DELETE FROM subscribes s
WHERE s.id NOT IN (SELECT MIN(s1.id) FROM SUBSCRIBES s1
GROUP BY s1.subscribeable_type, s1.user_id, s1.status, s1.subscribeable_id)
SQL
end
def down
end
end