Monkey patch for foreign keys