Add entity-related columns to vulnerability_occurrences
What does this MR do?
This MR resolves https://gitlab.com/gitlab-org/gitlab/-/issues/239172, adding entity-related columns to the vulnerability_occurrences table.
Does this MR meet the acceptance criteria?
Conformity
- [-] Changelog entry
- [-] Documentation (if required)
-
Code review guidelines -
Merge request performance guidelines -
Style guides -
Database guides -
Separation of EE specific content
Availability and Testing
-
Review and add/update tests for this feature/bug. Consider all test levels. See the Test Planning Process. - [-] Tested in all supported browsers
- [-] Informed Infrastructure department of a default or new setting change, if applicable per definition of done
Database
Migration:
== 20210105153342 AddEntityColumnsToVulnerabilityOccurrences: migrating =======
-- add_column(:vulnerability_occurrences, :description, :text)
-> 0.0015s
-- add_column(:vulnerability_occurrences, :message, :text)
-> 0.0004s
-- add_column(:vulnerability_occurrences, :solution, :text)
-> 0.0004s
-- add_column(:vulnerability_occurrences, :cve, :text)
-> 0.0004s
-- add_column(:vulnerability_occurrences, :location, :jsonb)
-> 0.0004s
== 20210105153342 AddEntityColumnsToVulnerabilityOccurrences: migrated (0.0032s)
== 20210105154321 AddTextLimitToVulnerabilityOccurrencesEntityColumns: migrating
-- transaction_open?()
-> 0.0000s
-- current_schema()
-> 0.0003s
-- execute("ALTER TABLE vulnerability_occurrences\nADD CONSTRAINT check_ade261da6b\nCHECK ( char_length(description) <= 15000 )\nNOT VALID;\n")
-> 0.0009s
-- current_schema()
-> 0.0002s
-- execute("SET statement_timeout TO 0")
-> 0.0002s
-- execute("ALTER TABLE vulnerability_occurrences VALIDATE CONSTRAINT check_ade261da6b;")
-> 0.0008s
-- execute("RESET ALL")
-> 0.0002s
-- transaction_open?()
-> 0.0000s
-- current_schema()
-> 0.0002s
-- execute("ALTER TABLE vulnerability_occurrences\nADD CONSTRAINT check_df6dd20219\nCHECK ( char_length(message) <= 3000 )\nNOT VALID;\n")
-> 0.0004s
-- current_schema()
-> 0.0002s
-- execute("ALTER TABLE vulnerability_occurrences VALIDATE CONSTRAINT check_df6dd20219;")
-> 0.0005s
-- transaction_open?()
-> 0.0000s
-- current_schema()
-> 0.0002s
-- execute("ALTER TABLE vulnerability_occurrences\nADD CONSTRAINT check_4a3a60f2ba\nCHECK ( char_length(solution) <= 7000 )\nNOT VALID;\n")
-> 0.0004s
-- current_schema()
-> 0.0002s
-- execute("ALTER TABLE vulnerability_occurrences VALIDATE CONSTRAINT check_4a3a60f2ba;")
-> 0.0006s
-- transaction_open?()
-> 0.0000s
-- current_schema()
-> 0.0002s
-- execute("ALTER TABLE vulnerability_occurrences\nADD CONSTRAINT check_f602da68dd\nCHECK ( char_length(cve) <= 48400 )\nNOT VALID;\n")
-> 0.0003s
-- current_schema()
-> 0.0002s
-- execute("ALTER TABLE vulnerability_occurrences VALIDATE CONSTRAINT check_f602da68dd;")
-> 0.0006s
== 20210105154321 AddTextLimitToVulnerabilityOccurrencesEntityColumns: migrated (0.0250s)
Rollback:
== 20210105154321 AddTextLimitToVulnerabilityOccurrencesEntityColumns: reverting
-- execute("ALTER TABLE vulnerability_occurrences\nDROP CONSTRAINT IF EXISTS check_ade261da6b\n")
-> 0.0010s
-- execute("ALTER TABLE vulnerability_occurrences\nDROP CONSTRAINT IF EXISTS check_df6dd20219\n")
-> 0.0003s
-- execute("ALTER TABLE vulnerability_occurrences\nDROP CONSTRAINT IF EXISTS check_4a3a60f2ba\n")
-> 0.0003s
-- execute("ALTER TABLE vulnerability_occurrences\nDROP CONSTRAINT IF EXISTS check_f602da68dd\n")
-> 0.0003s
== 20210105154321 AddTextLimitToVulnerabilityOccurrencesEntityColumns: reverted (0.0145s)
== 20210105153342 AddEntityColumnsToVulnerabilityOccurrences: reverting =======
-- remove_column(:vulnerability_occurrences, :location, :jsonb)
-> 0.0014s
-- remove_column(:vulnerability_occurrences, :cve, :text)
-> 0.0003s
-- remove_column(:vulnerability_occurrences, :solution, :text)
-> 0.0002s
-- remove_column(:vulnerability_occurrences, :message, :text)
-> 0.0003s
-- remove_column(:vulnerability_occurrences, :description, :text)
-> 0.0004s
== 20210105153342 AddEntityColumnsToVulnerabilityOccurrences: reverted (0.0086s)