Skip to content

Adds pipeline_id to dependency_list_exports table

Aditya Tiwari requested to merge add-sbom-export into master

What does this MR do and why?

Adds pipeline_id to dependency_list_exports table

DB Explanation:

  1. pipeline_id is allowed to be nil here.
  2. Foreign key to ci_pipelines table can not be added as this table is in a different database, reference. The only drawback here would be that it will be difficult to maintain the data consistency but that should have less impact on us because we will run the query related to ci_pipelines in the background and we will have a fixed lifespan of this record(1-24hours).

Database

Query on this table:


EXPLAIN for: SELECT "dependency_list_exports".* FROM "dependency_list_exports" WHERE "dependency_list_exports"."id" = 9 /*application:console,db_config_name:main,console_hostname:aditya-works-MacBook-Pro.local,console_username:work,line:(pry):6:in `__pry__'*/
                                                 QUERY PLAN
-------------------------------------------------------------------------------------------------------------
 Index Scan using dependency_list_exports_pkey on dependency_list_exports  (cost=0.29..2.31 rows=1 width=94)
   Index Cond: (id = 9)
(2 rows)

Dependencies::DependencyListExport Load (0.6ms)  SELECT "dependency_list_exports".* FROM "dependency_list_exports" WHERE "dependency_list_exports"."pipeline_id" = 9 /*application:console,db_config_name:main,console_hostname:aditya-works-MacBook-Pro.local,console_username:work,line:(pry):7:in `__pry__'*/
=> EXPLAIN for: SELECT "dependency_list_exports".* FROM "dependency_list_exports" WHERE "dependency_list_exports"."pipeline_id" = 9 /*application:console,db_config_name:main,console_hostname:aditya-works-MacBook-Pro.local,console_username:work,line:(pry):7:in `__pry__'*/
                                                           QUERY PLAN
---------------------------------------------------------------------------------------------------------------------------------
 Index Scan using index_dependency_list_exports_on_pipeline_id on dependency_list_exports  (cost=0.12..109.43 rows=130 width=94)
   Index Cond: (pipeline_id = 9)
(2 rows)

How to set up and validate locally

  1. Pull the branch.
  2. Run the migration and run the specs.

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.

Issue

#333463 (closed)

Edited by Aditya Tiwari

Merge request reports