I don't think content_view_version_environments and content_view_environments are linked. Might want to connect content_view_version_environments with just environments table.