Skip to content

Add default value for file_store to ci_pipeline_artifacts

Max Orefice requested to merge mo-add-default-value-to-pipeline-artifact into master

What does this MR do?

This MR adds a default value for our file_store column in our new model PipelineArtifact

Why are we doing this?

This column is being updated after record creation as explained here (Coming from Carrierwave 🤷‍♂️)

The file.object_store is set during uploader.store! # which happens after object is inserted/updated

To avoid specifying this param during record creation, we decided to set up a default value. This is similar approach we are doing with our JobArtifact.

Migration output

$ bin/rails db:migrate
== 20200811194848 AddDefaultValueForFileStoreToPipelineArtifact: migrating ====
-- change_column_default(:ci_pipeline_artifacts, :file_store, 1)
   -> 0.0030s
== 20200811194848 AddDefaultValueForFileStoreToPipelineArtifact: migrated (0.0095s)

Migration Rollback

$ bin/rails db:rollback
== 20200811194848 AddDefaultValueForFileStoreToPipelineArtifact: reverting ====
-- change_column_default(:ci_pipeline_artifacts, :file_store, nil)
   -> 0.0030s
== 20200811194848 AddDefaultValueForFileStoreToPipelineArtifact: reverted (0.0076s)

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
Edited by Max Orefice

Merge request reports