Upload.joins(<<~SQL).where('projects.storage_version < :version OR projects.storage_version IS NULL',version: Project::HASHED_STORAGE_FEATURES[:attachments])
Upload.joins(<<~SQL).where('projects.storage_version < :version OR projects.storage_version IS NULL',version: Project::HASHED_STORAGE_FEATURES[:attachments])
JOIN projects
JOIN projects
ON (uploads.model_type='Project' AND uploads.model_id=projects.id)
ON (uploads.model_type='Project' AND uploads.model_id=projects.id)