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开发者_JS百科, :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
OLD ONE
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
The best solution is
remove_foreign_key :threads, :users
However, the following should have also worked:
remove_foreign_key :threads, :column => :user_id
If it didn't, file a bug on my library.
 
         
                                         
                                         
                                         
                                        ![Interactive visualization of a graph in python [closed]](https://www.devze.com/res/2023/04-10/09/92d32fe8c0d22fb96bd6f6e8b7d1f457.gif) 
                                         
                                         
                                         
                                         加载中,请稍侯......
 加载中,请稍侯......
      
精彩评论