Fixes: #2894 Using foreign keys in repository plugin