• Rémy Coutable's avatar
    Merge branch 'artifacts-from-ref-and-build-name-api' into 'master' · 00e8d26e
    Rémy Coutable authored
    Simpler two queries than one JOIN with subquery
    
    This is a follow up from !5347
    
    Originally it was:
    
    ``` ruby
    pipeline = pipelines.latest_successful_for(ref)
    builds.where(pipeline: pipeline).latest.with_artifacts
    ```
    
    However MySQL would complain that we can't use `IN` against a subquery which has `LIMIT`. Using `INNER JOIN` would be a workaround, however, doing that is too complicated in current version of Rails.
    
    So let's just use two queries in this case.
    
    Closes #14419
    
    See merge request !5388
    00e8d26e
builds.rb 7.88 KB