2012-03-22 17:11:12 +00:00
|
|
|
# -*- 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
|