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

13 lines
329 B
Ruby
Raw Permalink Normal View History

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