Add original_filename to CiJobArtifact
Ref: #285597 (closed)
What does this MR do and why?
This MR adds original_filename
to CiJobArtifact
.
This is the first step to solve #285597 (closed) which will improve the ~performance and reliability of how Artifacts
are being uploaded.
Why are we doing this?
In our POC we discovered that without persisting the filename when creating an artifact it's impossible to retrieve the artifact of a given job without altering the user experience.
Database review
New column
DB migration
$ bin/rails db:migrate
== 20211119085015 AddOrignalFilenameToCiJobArtifact: migrating ================
-- add_column(:ci_job_artifacts, :original_filename, :text)
-> 0.0015s
== 20211119085015 AddOrignalFilenameToCiJobArtifact: migrated (0.0016s) =======
DB rollback
$ bin/rails db:rollback
== 20211119085015 AddOrignalFilenameToCiJobArtifact: reverting ================
-- remove_column(:ci_job_artifacts, :original_filename, :text)
-> 0.0013s
== 20211119085015 AddOrignalFilenameToCiJobArtifact: reverted (0.0014s) =======
New constraint
DB migration
$ bin/rails db:migrate
== 20211119085036 AddTextLimitToJobArtifactOriginalFilename: migrating ========
-- transaction_open?()
-> 0.0000s
-- current_schema()
-> 0.0002s
-- transaction_open?()
-> 0.0000s
-- execute("ALTER TABLE ci_job_artifacts\nADD CONSTRAINT check_85573000db\nCHECK ( char_length(original_filename) <= 255 )\nNOT VALID;\n")
-> 0.0030s
-- current_schema()
-> 0.0001s
-- execute("SET statement_timeout TO 0")
-> 0.0005s
-- execute("ALTER TABLE ci_job_artifacts VALIDATE CONSTRAINT check_85573000db;")
-> 0.0015s
-- execute("RESET statement_timeout")
-> 0.0005s
== 20211119085036 AddTextLimitToJobArtifactOriginalFilename: migrated (0.0126s)
DB rollback
$ bin/rails db:rollback
== 20211119085036 AddTextLimitToJobArtifactOriginalFilename: reverting ========
-- transaction_open?()
-> 0.0000s
-- transaction_open?()
-> 0.0000s
-- execute("ALTER TABLE ci_job_artifacts\nDROP CONSTRAINT IF EXISTS check_85573000db\n")
-> 0.0013s
== 20211119085036 AddTextLimitToJobArtifactOriginalFilename: reverted (0.0256s)
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.
Edited by Max Orefice