Fix builds relation on Ci::RunnerManager
What does this MR do and why?
This MR fixes the Ci::RunnerManager#builds
Active Record relation, which started failing after the rename of RunnerMachine
to RunnerManager
:
[49] pry(main)> ::Ci::RunnerManager.find(130).builds.to_a
Ci::RunnerManager Load (4.5ms) SELECT "ci_runner_machines".* FROM "ci_runner_machines" WHERE "ci_runner_machines"."id" = 130 LIMIT 1 /*application:console,db_config_name:ci,console_hostname:Pedros-MacBook-Pro-M1-Max.local,console_username:pedropombeiro,line:(pry):49:in `__pry__'*/
Ci::Build Load (0.5ms) SELECT "ci_builds".* FROM "ci_builds" INNER JOIN "p_ci_runner_machine_builds" ON "ci_builds"."id" = "p_ci_runner_machine_builds"."build_id" WHERE "ci_builds"."type" = 'Ci::Build' AND "p_ci_runner_machine_builds"."runner_manager_id" = 130 /*application:console,db_config_name:ci,console_hostname:Pedros-MacBook-Pro-M1-Max.local,console_username:pedropombeiro,line:(pry):49:in `__pry__'*/
ActiveRecord::StatementInvalid: PG::UndefinedColumn: ERROR: column p_ci_runner_machine_builds.runner_manager_id does not exist
LINE 1: ...ld_id" WHERE "ci_builds"."type" = 'Ci::Build' AND "p_ci_runn...
I don't think this relation method is currently being used (but will be in an upcoming MR, hence this preliminary fix).
Screenshots or screen recordings
Screenshots are required for UI changes, and strongly recommended for all other merge requests.
Before | After |
---|---|
How to set up and validate locally
Numbered steps to set up and validate the change are strongly suggested.
In the GDK console, run the following expression:
::Ci::RunnerManager.last.builds.to_a
It should return a collection, instead of the previous error.
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.
Part of #415453 (closed)
Edited by Pedro Pombeiro