Issue #2409873 by Dave Reid: Fixed missing foreign key information from relation and relation_revision