May be the following kosher?
schema.rb users id:int (autoincr.) uid:string <---------------- ... fb_friends id:int (autoincr.) uid:int <------------------- friend_uid:int ... user.rb has_many :fb_friends, :primary_key => "uid", :foreign_key => "uid"
Observe that the secrets that tie a "user" as well as their "facebook_buddies" together are of various data types (string and int). In a perfect world, I most likely wouldn't do that, but because of the current system architecture, this appears to become the answer that will perform best.
But is okay to complete / does it work without snafoos?
It is dependent around the DB engine you are using, e.g, for mysql =>
Corresponding posts within the foreign key and also the recommended key should have similar internal data types inside InnoDB to ensure that they may be in comparison with no type conversion. The dimensions and manifestation of integer types should be the same. The size of string types need 't be exactly the same. For nonbinary (character) string posts, the character set and collation should be exactly the same.
More information here, Anyways, I will not say it is a good practice to check fields of various types :(.
Hope it will help you!
Unsure whether it works, however i wouldn't recommend it if you possess the choice to change it out. It is simple to change a column key in a Rails migration:
change_column :users, :uuid, :integer