diaspora/db/migrate/20110517180148_delete_all_new_request_notifications.rb

14 lines
431 B
Ruby

class DeleteAllNewRequestNotifications < ActiveRecord::Migration
class Notification < ActiveRecord::Base; end
def self.up
execute <<SQL if Notification.count > 0
DELETE notifications.* FROM notifications
WHERE notifications.type = 'Notifications::NewRequest'
OR notifications.type = 'Notifications::RequestAccepted'
SQL
end
def self.down
raise ActiveRecord::IrreversibleMigration.new
end
end