Add source property to Ci::Build
What does this MR do and why?
Adds the source
association to Ci::Build
from Ci::BuildSource
added in !155153 (merged).
Note: this value is not currently populated in production pipelines; the feature will be added in a future MR. Sample data was inserted for the queries below.
Query plans
Seeded lab DB with 1000 build source rows: https://console.postgres.ai/gitlab/gitlab-production-ci/sessions/29718/commands/92317
Select query from association: https://console.postgres.ai/gitlab/gitlab-production-ci/sessions/29718/commands/92319
Raw SQL:
SELECT "p_ci_build_sources".* FROM "p_ci_build_sources" WHERE "p_ci_build_sources"."build_id" = 7000000001
Append (cost=0.14..3.18 rows=3 width=26) (actual time=0.015..0.015 rows=0 loops=1)
Buffers: shared hit=1
I/O Timings: read=0.000 write=0.000
-> Index Scan using ci_build_sources_100_pkey on gitlab_partitions_dynamic.ci_build_sources_100 p_ci_build_sources_1 (cost=0.14..3.16 rows=1 width=26) (actual time=0.010..0.010 rows=0 loops=1)
Index Cond: (p_ci_build_sources_1.build_id = '7000000001'::bigint)
Buffers: shared hit=1
I/O Timings: read=0.000 write=0.000
-> Seq Scan on gitlab_partitions_dynamic.ci_build_sources_101 p_ci_build_sources_2 (cost=0.00..0.00 rows=1 width=26) (actual time=0.002..0.002 rows=0 loops=1)
Filter: (p_ci_build_sources_2.build_id = '7000000001'::bigint)
Rows Removed by Filter: 0
I/O Timings: read=0.000 write=0.000
-> Seq Scan on gitlab_partitions_dynamic.ci_build_sources_102 p_ci_build_sources_3 (cost=0.00..0.00 rows=1 width=26) (actual time=0.003..0.003 rows=0 loops=1)
Filter: (p_ci_build_sources_3.build_id = '7000000001'::bigint)
Rows Removed by Filter: 0
I/O Timings: read=0.000 write=0.000
Related to #458803 (closed)
Edited by Aaron Huntsman