Skip to content

Replace hardcoded table names with arel values

Marius Bobin requested to merge 358943-ci-pipelines-hardcoded-table-name into master

What does this MR do and why?

Related to #358943 (closed)

I've noticed this while working on !92440 (diffs, comment 1026630646) and it's something worth fixing for the future work on CI data partitioning.

Before:

[2] pry(main)> Ci::Pipeline.created_after(1.day.ago).to_sql
=> "SELECT \"ci_pipelines\".* FROM \"ci_pipelines\" WHERE (ci_pipelines.created_at > '2022-07-14 10:22:28.708263')"
[3] pry(main)> Ci::Pipeline.created_before_id(1000).to_sql
=> "SELECT \"ci_pipelines\".* FROM \"ci_pipelines\" WHERE (ci_pipelines.id < 1000)"

After:

[1] pry(main)> Ci::Pipeline.created_after(1.day.ago).to_sql
=> "SELECT \"ci_pipelines\".* FROM \"ci_pipelines\" WHERE \"ci_pipelines\".\"created_at\" > '2022-07-14 10:27:51.214217'"
[2] pry(main)> Ci::Pipeline.created_before_id(1000).to_sql
=> "SELECT \"ci_pipelines\".* FROM \"ci_pipelines\" WHERE \"ci_pipelines\".\"id\" < 1000"

Screenshots or screen recordings

These are strongly recommended to assist reviewers and reduce the time to merge your change.

How to set up and validate locally

Numbered steps to set up and validate the change are strongly suggested.

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Marius Bobin

Merge request reports

Loading