Skip to content

Migrate sbom_components.name so to match PEP 503

What does this MR do and why?

Migrate sbom_components.name so to match PEP 503

Changelog: changed

Related issue: #440391 (closed)

Production data

gitlabhq_dblab=# select count(*) from sbom_components where purl_type = 8 and name like '%\_%';
 count
-------
     0
(1 row)

gitlabhq_dblab=# select count(*) from sbom_components where purl_type = 8 and name like '%--%';
 count
-------
     0
(1 row)

gitlabhq_dblab=# select count(*) from sbom_components where purl_type = 8 and name like '%.%';
 count
-------
   413
(1 row)

DB migrate/rollback

$ bundle exec rails db:migrate
main: == [advisory_lock_connection] object_id: 119540, pg_backend_pid: 1329
main: == 20240223130548 QueueUpdateSbomComponentsNameBasedOnPep503: migrating =======
main: == 20240223130548 QueueUpdateSbomComponentsNameBasedOnPep503: migrated (0.0550s)

main: == [advisory_lock_connection] object_id: 119540, pg_backend_pid: 1329
ci: == [advisory_lock_connection] object_id: 119920, pg_backend_pid: 1333
ci: == 20240223130548 QueueUpdateSbomComponentsNameBasedOnPep503: migrating =======
ci: -- The migration is skipped since it modifies the schemas: [:gitlab_main].
ci: -- This database can only apply migrations in one of the following schemas: [:gitlab_ci, :gitlab_internal, :gitlab_shared].
ci: == 20240223130548 QueueUpdateSbomComponentsNameBasedOnPep503: migrated (0.0084s)

ci: == [advisory_lock_connection] object_id: 119920, pg_backend_pid: 1333
$ bundle exec rails db:migrate:down:main VERSION=20240223130548
main: == [advisory_lock_connection] object_id: 119320, pg_backend_pid: 294
main: == [advisory_lock_connection] object_id: 119320, pg_backend_pid: 294

Query plan for a single record

Link to plan

UPDATE "sbom_components" SET "updated_at" = '2024-02-26 15:38:54.343479', "name" = 'yargs-parser' WHERE "sbom_components"."id" = 8783

MR acceptance checklist

Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

How to set up and validate locally

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

Edited by Zamir Martins

Merge request reports

Loading