Skip to content

Add `link_type` column to `release_links` table

Sean Carroll requested to merge 207257-specify-asset-types-in-releases-db into master

What does this MR do?

  • Add link_type column to release_links
  • Add an enum to manage valid values for link_type

DB Migration and Rollback

As per this document

Add the output of both migrating and rolling back for all migrations into the MR description

  • Ensure the down method reverts the changes in db/structure.sql
  • Update the migration output whenever you modify the migrations during the review process

Migrate

❯ rails db:migrate
== 20200527092027 AddLinkTypeToReleaseLinks: migrating ========================
-- add_column(:release_links, :link_type, :integer, {:default=>0})
   -> 0.0013s
== 20200527092027 AddLinkTypeToReleaseLinks: migrated (0.0079s) ===============

Rollback

❯ rails db:rollback STEP=1
== 20200527092027 AddLinkTypeToReleaseLinks: reverting ========================
-- remove_column(:release_links, :link_type)
   -> 0.0014s
== 20200527092027 AddLinkTypeToReleaseLinks: reverted (0.0070s) ===============

Existing table rowcount

  • 32476 rows on gitlab.com
/chatops run explain select id from release_links;

Index Only Scan using release_links_pkey on release_links  (cost=0.29..954.18 rows=32464 width=8) (actual time=1.126..26.571 rows=32476 loops=1)
  Heap Fetches: 2238
  Buffers: shared hit=1619 read=181
  I/O Timings: read=16.212
Planning Time: 0.805 ms
Execution Time: 28.326 ms

Does this MR meet the acceptance criteria?

Conformity

Availability and Testing

Security

If this MR contains changes to processing or storing of credentials or tokens, authorization and authentication methods and other items described in the security review guidelines:

  • Label as security and @ mention @gitlab-com/gl-security/appsec
  • The MR includes necessary changes to maintain consistency between UI, API, email, or other methods
  • Security reports checked/validated by a reviewer from the AppSec team

Part of #207257 (closed)

Edited by Sean Carroll

Merge request reports