I have no problem with adding the foreign key constraint with this gem:
http://github.com/matthuhiggins/foreigner
However, I cannot remove the foreign key.
class ForeignKeys < ActiveRecord::Migration
def self.up
add_foreign_key(:threads, :users)
end
def self.down
remove_foreign_key(:threads, :column => :user_id)
end
end
Could someone help me out here.
Thanks.
This the last thing I can think of.
def self.down
execute 'ALTER TABLE threads DROP FOREIGN KEY user_id'
end
These should work :)
remove_foreign_key :threads, { :column => :user_id }
or
remove_foreign_key('threads', 'user_id')
or
remove_foreign_key(:threads, :user_id)
Petr
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With