diff options
Diffstat (limited to 'db/migrate/20110406202932_drop_requests_table.rb')
-rw-r--r-- | db/migrate/20110406202932_drop_requests_table.rb | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/db/migrate/20110406202932_drop_requests_table.rb b/db/migrate/20110406202932_drop_requests_table.rb index bff8df042..96a9b1d4d 100644 --- a/db/migrate/20110406202932_drop_requests_table.rb +++ b/db/migrate/20110406202932_drop_requests_table.rb @@ -1,4 +1,6 @@ class DropRequestsTable < ActiveRecord::Migration + class Contact < ActiveRecord::Base; end + def self.up remove_foreign_key :requests, :column => :recipient_id remove_foreign_key :requests, :column => :sender_id @@ -14,7 +16,7 @@ class DropRequestsTable < ActiveRecord::Migration DELETE contacts.* FROM contacts WHERE contacts.sharing = false SQL -) + ) if Contact.count > 0 end def self.down |