Add VulnerabilityStateTransition model
This model will be responsible for storing state transitions of a Vulnerability.
Migration up
rake db:migrate:up:main VERSION=20220517182529
== 20220517182529 CreateVulnerabilityStateTransition: migrating ===============
-- create_table(:vulnerability_state_transitions, {})
-> 0.0151s
== 20220517182529 CreateVulnerabilityStateTransition: migrated (0.0152s) ======
Migration down
rake db:migrate:down:main VERSION=20220517182529
== 20220517182529 CreateVulnerabilityStateTransition: reverting ===============
-- drop_table(:vulnerability_state_transitions)
-> 0.0060s
== 20220517182529 CreateVulnerabilityStateTransition: reverted (0.0061s) ======
Merge request reports
Activity
changed milestone to %15.1
assigned to @mc_rocha
Suggested Reviewers (beta)
The individuals below may be good candidates to participate in the review based on various factors.
You can use slash commands in comments to quickly assign
/assign_reviewer @user1
.Suggested Reviewers @NikolayS
,@adriel
,@rymai
,@kmann
,@jdsalaro
If you do not believe these suggestions are useful, please apply the label Bad Suggested Reviewer. You can also provide feedback for this feature on this issue:
https://gitlab.com/gitlab-org/gitlab/-/issues/357923
.Automatically generated by Suggested Reviewers Bot - an experimental ML-based recommendation engine created by ~"group::applied ml".
Edited by GitLab Reviewer-Recommender Bot1 Warning b03199c7: Commits that change 30 or more lines across at least 3 files should describe these changes in the commit body. For more information, take a look at our Commit message guidelines. 1 Message This merge request adds or changes files that require a review from the Database team. If needed, you can retry the
danger-review
job that generated this comment.This merge request requires a database review. To make sure these changes are reviewed, take the following steps:
- Ensure the merge request has database and databasereview pending labels. If the merge request modifies database files, Danger will do this for you.
- Prepare your MR for database review according to the docs.
- Assign and mention the database reviewer suggested by Reviewer Roulette.
The following files require a review from the Database team:
db/docs/vulnerability_state_transitions.yml
db/migrate/20220517182529_create_vulnerability_state_transition.rb
db/migrate/20220517182529_create_vulnerability_state_transition.rb
db/schema_migrations/20220517182529
db/structure.sql
lib/gitlab/database/gitlab_schemas.yml
lib/gitlab/database/gitlab_schemas.yml
Reviewer roulette
Changes that require review have been detected!
Please refer to the table below for assigning reviewers and maintainers suggested by Danger in the specified category:
Category Reviewer Maintainer backend Brett Walker ( @digitalmoksha
) (UTC-5)Alex Pooley ( @alexpooley
) (UTC+8)database João Pereira ( @jdrpereira
) (UTC+1)Krasimir Angelov ( @krasio
) (UTC+12)~migration No reviewer available No maintainer available To spread load more evenly across eligible reviewers, Danger has picked a candidate for each review slot, based on their timezone. Feel free to override these selections if you think someone else would be better-suited or use the GitLab Review Workload Dashboard to find other available reviewers.
To read more on how to use the reviewer roulette, please take a look at the Engineering workflow and code review guidelines. Please consider assigning a reviewer or maintainer who is a domain expert in the area of the merge request.
Once you've decided who will review this merge request, assign them as a reviewer! Danger does not automatically notify them for you.
Generated by
DangerAllure report
allure-report-publisher
generated test report!review-qa-blocking:
test report for 56d25e59expand test summary
+-------------------------------------------------------------------+ | suites summary | +----------------------+--------+--------+---------+-------+--------+ | | passed | failed | skipped | flaky | result | +----------------------+--------+--------+---------+-------+--------+ | Create | 22 | 1 | 2 | 23 | ❌ | | Plan | 40 | 1 | 1 | 41 | ❌ | | Verify | 11 | 1 | 1 | 12 | ❌ | | Version sanity check | 0 | 0 | 1 | 0 | ➖ | | Manage | 35 | 1 | 2 | 38 | ❌ | | Configure | 0 | 0 | 1 | 0 | ➖ | | Protect | 2 | 0 | 0 | 2 | ❗ | | Package | 0 | 0 | 1 | 0 | ➖ | +----------------------+--------+--------+---------+-------+--------+ | Total | 110 | 4 | 9 | 116 | ❌ | +----------------------+--------+--------+---------+-------+--------+
added sectionsec label
added 425 commits
-
a0cfe137...7b599774 - 422 commits from branch
master
- fea7a6b7 - Add VulnerabilityStateTransition model
- 421fa78e - Move VulnerabilityStateTransition model to Vulnerabilities module
- 0eebf32b - Add VulnerabilityStateTransition model
Toggle commit list-
a0cfe137...7b599774 - 422 commits from branch
added 35 commits
-
0eebf32b...a434a913 - 31 commits from branch
master
- e31b8e56 - Add VulnerabilityStateTransition model
- 393fe62d - Move VulnerabilityStateTransition model to Vulnerabilities module
- 2ec7bc53 - Add VulnerabilityStateTransition model
- f237cef3 - Add missing database documentation files
Toggle commit list-
0eebf32b...a434a913 - 31 commits from branch
added 35 commits
-
0eebf32b...a434a913 - 31 commits from branch
master
- e31b8e56 - Add VulnerabilityStateTransition model
- 393fe62d - Move VulnerabilityStateTransition model to Vulnerabilities module
- 2ec7bc53 - Add VulnerabilityStateTransition model
- f237cef3 - Add missing database documentation files
Toggle commit list-
0eebf32b...a434a913 - 31 commits from branch
requested review from @Quintasan
Database migrations
1 Warnings 20220517182529 - CreateVulnerabilityStateTransition had a query that exceeded timing
guidelines. Run time should not exceed 100ms, but it was 356.98ms. Please consider possible options
to improve the query performance.CREATE TABLE "vulnerability_state_transitions" ("id"
bigserial primary key, "vulnerability_id" bigint NOT NULL, "to_state" smallint NOT NULL,
"from_state" smallint NOT NULL, "created_at" timestamptz NOT NULL, "updated_at" timestamptz NOT
NULL, CONSTRAINT "fk_rails_60e4899648" FOREIGN KEY ("vulnerability_id") REFERENCES "vulnerabilities"
("id") ON DELETE CASCADE)
/*application:test,db_config_name:main,line:/lib/gitlab/database/migration_helpers/v2.rb:46:in
`create_table'*/Migrations included in this change have been executed on gitlab.com data for testing purposes. For details, please see the migration testing pipeline (limited access).
Migration Type Total runtime Result DB size change 20220517182529 - CreateVulnerabilityStateTransition Regular 1.9 s +24.00 KiB Runtime Histogram for all migrations
Query Runtime Count 0 seconds - 0.01 seconds 0 0.01 seconds - 0.1 seconds 1 0.1 seconds - 1 second 1 1 second - 5 minutes 0 5 minutes + 0 Migration: 20220517182529 - CreateVulnerabilityStateTransition- Type: Regular
- Duration: 1.9 s
- Database size change: +24.00 KiB
Query Calls Total Time Max Time Mean Time Rows CREATE TABLE "vulnerability_state_transitions" ("id" bigserial primary key, "vulnerability_id" bigint NOT NULL, "to_state" smallint NOT NULL, "from_state" smallint NOT NULL, "created_at" timestamptz NOT NULL, "updated_at" timestamptz NOT NULL, CONSTRAINT "fk_rails_60e4899648" FOREIGN KEY ("vulnerability_id") REFERENCES "vulnerabilities" ("id") ON DELETE CASCADE) /*application:test,db_config_name:main,line:/lib/gitlab/database/migration_helpers/v2.rb:46:in `create_table'*/
1 357.0 ms 357.0 ms 357.0 ms 0 CREATE INDEX "index_vulnerability_state_transitions_on_vulnerability_id" ON "vulnerability_state_transitions" ("vulnerability_id") /*application:test,db_config_name:main,line:/lib/gitlab/database/migration_helpers/v2.rb:46:in `create_table'*/
1 7.6 ms 7.6 ms 7.6 ms 0 Histogram for CreateVulnerabilityStateTransition
Query Runtime Count 0 seconds - 0.01 seconds 0 0.01 seconds - 0.1 seconds 1 0.1 seconds - 1 second 1 1 second - 5 minutes 0 5 minutes + 0
Background migrations
Other migrations pending on GitLab.com
Migration Type Total runtime Result DB size change Clone Details
Clone ID Clone Created At Clone Data Timestamp Expected Removal Time database-testing-1214347
2022-05-20T08:13:01Z 2022-05-20T04:11:22Z 2022-05-20 20:14:56 +0000 Artifacts
Brought to you by gitlab-org/database-team/gitlab-com-database-testing. Epic
- A deleted user
added database-testing-automation label
- Resolved by Alex Pooley
- Resolved by Alex Pooley
@mc_rocha as per Database Review Guidelines you should provide output of
up
anddown
migrations in the MR description. That said, we also havedb:gitlabcom-database-testing
manual job which will do that for you can you can just fire it (which I did, see the comment above).
- Resolved by Alex Pooley
question to maintainer: If my Postgres foo is correct then I think that adding an index on
(vulnerability_id, created_at DESC)
would be beneficial here because:- Indexes on foreign keys are mandatory
- We will most likely want to present the state transition from the latest one to the first one (
ORDER BY created_at DESC
) - The same index would be used for queries like
SELECT * FROM vulnerability_state_transitions WHERE vulnerability_in (1,2,3,...,n);
That way we could drop
index: true
from the migration creating the table and would have one index left
removed review request for @Quintasan
@ahegyi
, thanks for approving this merge request.This is the first time the merge request is approved. To ensure full test coverage, a new pipeline has been started.
For more info, please refer to the following links:
mentioned in issue #363049 (closed)
added 144 commits
-
f237cef3...2a8dee56 - 139 commits from branch
master
- 78cebca4 - Add VulnerabilityStateTransition model
- 21d3bc1b - Move VulnerabilityStateTransition model to Vulnerabilities module
- a6763085 - Add VulnerabilityStateTransition model
- 76278c69 - Add missing database documentation files
- a691d682 - Rename State Transition model
Toggle commit list-
f237cef3...2a8dee56 - 139 commits from branch
requested review from @Quintasan
added 714 commits
-
a691d682...c9b29f3c - 709 commits from branch
master
- e7b346da - Add VulnerabilityStateTransition model
- b03199c7 - Move VulnerabilityStateTransition model to Vulnerabilities module
- 2f43c632 - Add VulnerabilityStateTransition model
- 5cde4b98 - Add missing database documentation files
- 56d25e59 - Rename State Transition model
Toggle commit list-
a691d682...c9b29f3c - 709 commits from branch
removed review request for @Quintasan
requested review from @alexpooley
@Quintasan LGTM!
enabled an automatic merge when the pipeline for 0f747e98 succeeds
mentioned in commit 4b769c4a
added workflowstaging-canary label
added workflowcanary label and removed workflowstaging-canary label
added workflowstaging label and removed workflowcanary label
added workflowproduction label and removed workflowstaging label
mentioned in issue gitlab-com/www-gitlab-com#8084 (closed)
mentioned in merge request !88875 (merged)
mentioned in issue #325700 (closed)
mentioned in issue #361650 (closed)
added releasedpublished label
mentioned in merge request kubitus-project/kubitus-installer!1153 (merged)
mentioned in merge request gitlab-com/www-gitlab-com!85572 (closed)
added releasedcandidate label and removed releasedpublished label
mentioned in issue #433505 (closed)